@teammy/server 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/assets/Assistant-DJV9aVRy.js +1 -0
- package/dist/web/assets/{Dashboard-BzmrE4Xv.js → Dashboard-CDLBK91Q.js} +1 -1
- package/dist/web/assets/{Files-BvCYgjVV.js → Files-Ctal40MO.js} +1 -1
- package/dist/web/assets/{Markdown-BRPMsc7D.js → Markdown-TnAER8HW.js} +1 -1
- package/dist/web/assets/{Materials-DK3CkLr0.js → Materials-CFm4FvpO.js} +1 -1
- package/dist/web/assets/{Sessions-D_579m-e.js → Sessions-CAEjqZpk.js} +1 -1
- package/dist/web/assets/{WorkspaceTree-fMDtGIFa.js → WorkspaceTree-DN1U-aDQ.js} +1 -1
- package/dist/web/assets/{file-links-I1K8CwVK.js → file-links-bWpY4fpg.js} +1 -1
- package/dist/web/assets/{index-DQsx-e5d.js → index-DouLQdFE.js} +2 -2
- package/dist/web/downloads/teammy-skill.zip +0 -0
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/assets/Assistant-BeYamS0w.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$ as e,A as t,D as n,J as r,M as i,O as a,S as o,W as s,a as c,b as l,et as ee,f as u,i as d,j as te,k as f,n as p,o as m,q as h,r as ne,t as re,u as ie,v as ae,y as oe}from"./index-DouLQdFE.js";import{t as se}from"./Markdown-TnAER8HW.js";var g=e(),_=t(),v=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}),y=e=>e.replace(/[#*_`>]/g,``).replace(/\s+/g,` `).trim();function b({mine:e=!1,author:t,time:n,children:r}){return(0,_.jsx)(`div`,{className:`assistant-bubble-row ${e?`mine`:``}`,children:(0,_.jsxs)(`div`,{className:`assistant-bubble`,children:[(0,_.jsxs)(`div`,{className:`assistant-bubble-meta`,children:[(0,_.jsx)(`span`,{children:t}),(0,_.jsx)(`time`,{dateTime:n,children:v(n)})]}),r]})})}function x({me:e}){let{projectId:t,request:x}=ie(),C=f(),w=a(t,e,`assistant-selection`),T=a(t,e,`assistant-drafts`),ce=(0,g.useCallback)(e=>x(`agents/outbox`,c,{signal:e}),[x]),E=n(ce,3e3,a(t,e,`outbox`)),le=(0,g.useCallback)(e=>x(`agents/chats`,re,{signal:e}),[x]),D=n(le,3e3,a(t,e,`chats`)),[O,ue]=(0,g.useState)(()=>{let e=new URLSearchParams(location.search),t=e.get(`chat`);return t?`chat:${t}`:e.get(`message`)??C?.get(w)??``}),k=O.startsWith(`chat:`)?O.slice(5):``,A=!O||!!k,[j,M]=(0,g.useState)(()=>C?.get(a(t,e,`chat`,k))),N=j?.id===k?j:C?.get(a(t,e,`chat`,k)),de=D.data?.chats.find(e=>e.id===k),[fe,P]=(0,g.useState)(),[F,I]=(0,g.useState)(()=>C?.get(T)??{}),L=F[O]??``,R=e=>I(t=>({...t,[O]:e})),[z,B]=(0,g.useState)(!1),[V,H]=(0,g.useState)(!1),[pe,U]=(0,g.useState)(``),[W,G]=(0,g.useState)(``),K=(0,g.useRef)(new Map),me=(0,g.useRef)(null),q=(0,g.useRef)(!0),J=(0,g.useRef)(O);J.current=O,(0,g.useEffect)(()=>{j&&C?.set(a(t,e,`chat`,j.id),j)},[C,t,e,j]),(0,g.useEffect)(()=>{C?.set(T,F)},[C,T,F]);function Y(e){J.current=e,ue(e),C?.set(w,e);let t=new URL(location.href);e.startsWith(`chat:`)?t.searchParams.set(`chat`,e.slice(5)):t.searchParams.delete(`chat`),e&&!e.startsWith(`chat:`)&&e!==`debug`?t.searchParams.set(`message`,e):t.searchParams.delete(`message`),history.replaceState(history.state,``,t)}(0,g.useEffect)(()=>{!O&&D.data?.chats.length&&Y(`chat:${D.data.chats[0].id}`)},[O,D.data]);let X=(E.data?.messages??[]).filter(e=>e.box===`debug`).reverse(),Z=E.data?.messages.find(e=>e.id===(O===`debug`?fe:O));(0,g.useEffect)(()=>{O!==`debug`&&Z?.conversationId&&Y(`chat:${Z.conversationId}`)},[O,Z?.conversationId]);let Q=X.filter(e=>!e.readAt).map(e=>e.id).join(`,`);(0,g.useEffect)(()=>{Z&&!Z.readAt&&O!==`debug`&&x(`agents/outbox/${Z.id}/read`,m,{method:`POST`}).then(()=>{window.dispatchEvent(new Event(`teammy:outbox`)),E.reload()}).catch(e=>U(i(e)))},[Z?.id,Z?.readAt,O,x,E.reload]),(0,g.useEffect)(()=>{O===`debug`&&Q&&Promise.all(Q.split(`,`).map(e=>x(`agents/outbox/${e}/read`,m,{method:`POST`}))).then(()=>{window.dispatchEvent(new Event(`teammy:outbox`)),E.reload()}).catch(e=>U(i(e)))},[O,Q,x,E.reload]),(0,g.useEffect)(()=>{if(G(``),!k)return;let n=!0,o=-1,s=!1,c=new AbortController,l=e=>{!n||e.id!==k||e.cursor<o||(o=e.cursor,s=!0,e.redirect?Y(`chat:${e.redirect}`):(M(e),G(``)))};x(`agents/chats/${k}`,p,{signal:c.signal}).then(l).catch(r=>{n&&!c.signal.aborted&&(r instanceof te&&[401,403,404].includes(r.status)&&(C?.delete(a(t,e,`chat`,k)),M(e=>e?.id===k?void 0:e)),s||G(i(r)))});let u=e=>{let t=Number(e.lastEventId);return!n||!Number.isSafeInteger(t)||t<=o?!1:(o=t,!0)},f=new EventSource(ee(`/api/v1/projects/${encodeURIComponent(t)}/agents/chats/${encodeURIComponent(k)}/events`));f.addEventListener(`snapshot`,e=>{if(n)try{l(p.parse(JSON.parse(e.data)))}catch(e){G(i(e))}}),f.onerror=()=>{n&&G(`对话连接中断,正在重新连接…`)},f.addEventListener(`context`,e=>{if(!u(e))return;let t=p.pick({kind:!0,title:!0,status:!0,visibility:!0,participants:!0,pending:!0,hold:!0,redirect:!0}).parse(JSON.parse(e.data));t.redirect?Y(`chat:${t.redirect}`):M(e=>e?.id===k?{...e,...t,cursor:o}:e)}),f.addEventListener(`message`,e=>{if(!u(e))return;let t=ne.parse(JSON.parse(e.data));M(n=>n?.id===k?{...n,readCursor:Math.max(n.readCursor,t.seq),cursor:Math.max(n.cursor,Number(e.lastEventId)||0),messages:[...n.messages.filter(e=>e.id!==t.id),t].sort((e,t)=>e.seq-t.seq)}:n)}),f.addEventListener(`message_removed`,e=>{if(!u(e))return;let{id:t}=h({id:r()}).parse(JSON.parse(e.data));M(e=>e?.id===k?{...e,cursor:o,messages:e.messages.filter(e=>e.id!==t)}:e)}),f.addEventListener(`run`,e=>{if(!u(e))return;let t=d.parse(JSON.parse(e.data));M(n=>n?.id===k?{...n,cursor:Math.max(n.cursor,Number(e.lastEventId)||0),runs:n.runs.some(e=>e.id===t.id)?n.runs:[...n.runs,t]}:n)});for(let e of[`delta`,`reset`,`state`])f.addEventListener(e,t=>{if(!u(t))return;let n=JSON.parse(t.data);M(r=>r?.id===k?{...r,cursor:Math.max(r.cursor,Number(t.lastEventId)||0),messages:r.messages.map(t=>t.runId!==n.id||t.role!==`assistant`?t:{...t,body:e===`delta`?t.body+(n.text??``):e===`reset`?``:n.answer??t.body,state:n.state??t.state}),runs:r.runs.map(t=>t.id===n.id?{...t,answer:e===`delta`?t.answer+(n.text??``):e===`reset`?``:n.answer??t.answer,state:n.state??t.state,error:n.error===void 0?t.error:n.error}:t)}:r)});return()=>{n=!1,c.abort(),f.close()}},[t,k,e,x,C]),(0,g.useEffect)(()=>{if(!N?.kind||N.id!==k)return;let e=()=>{document.visibilityState===`visible`&&x(`agents/chats/${k}/read`,h({ok:s()}),{method:`POST`,body:{cursor:N.readCursor}}).then(()=>{D.reload(),window.dispatchEvent(new Event(`teammy:outbox`))}).catch(e=>U(i(e)))},t=setTimeout(e,300);return document.addEventListener(`visibilitychange`,e),()=>{clearTimeout(t),document.removeEventListener(`visibilitychange`,e)}},[k,N?.readCursor,N?.kind,x]),(0,g.useEffect)(()=>{q.current&&me.current?.scrollIntoView({block:`end`})},[O,j?.messages,Z?.recipients,X.length]);function he(){window.dispatchEvent(new Event(`teammy:outbox`)),E.reload()}async function $(e){if(q.current=!0,Y(e),U(``),P(void 0),e.startsWith(`chat:`)||e===`debug`)return;let t=E.data?.messages.find(t=>t.id===e)?.conversationId;if(t)Y(`chat:${t}`);else try{await x(`agents/outbox/${e}/read`,m,{method:`POST`}),he()}catch(e){U(i(e))}}async function ge(){if(!V){H(!0),U(``);try{let e=await x(`agents/chats`,p,{method:`POST`});M(e),await $(`chat:${e.id}`),D.reload()}catch(e){U(i(e))}finally{H(!1)}}}async function _e(e){e.preventDefault();let t=L.trim();if(!t||z||V)return;B(!0),U(``);let n=K.current.get(O);n&&n.text===t||(n={text:t,id:crypto.randomUUID()},K.current.set(O,n));try{if(A){let e=n.target??k;if(!e){let r=await x(`agents/chats`,p,{method:`POST`});e=r.id,n.target=e,K.current.set(`chat:${e}`,n),I(n=>({...n,[`chat:${e}`]:t})),J.current===O&&(M(r),Y(`chat:${e}`))}let i=await x(`agents/chats/${e}`,d.extend({conversationId:r().optional()}),{method:`POST`,body:{text:t,requestId:n.id}});i.conversationId&&i.conversationId!==e&&(J.current===O||J.current===`chat:${e}`)&&Y(`chat:${i.conversationId}`),M(t=>t?.id===e?{...t,runs:t.runs.some(e=>e.id===i.id)?t.runs:[...t.runs,i]}:t),D.reload()}else{let e=await x(`agents/outbox/${Z.id}/reply`,h({conversationId:r()}),{method:`POST`,body:{body:t,requestId:n.id}});he(),J.current===O&&Y(`chat:${e.conversationId}`),D.reload(),P(void 0)}K.current.delete(O),n.target&&K.current.delete(`chat:${n.target}`),I(e=>({...e,[O]:``,...n.target?{[`chat:${n.target}`]:``}:{}}))}catch(e){U(i(e))}finally{B(!1)}}let ve=A||!!Z&&!Z.archivedAt,ye=A&&!N&&(!!k||!D.data);return(0,_.jsxs)(`div`,{className:`split-layout assistant-layout`,"data-testid":`assistant-page`,children:[(0,_.jsxs)(`aside`,{className:`assistant-list`,"aria-label":`消息列表`,children:[(0,_.jsxs)(`header`,{className:`assistant-list-heading`,children:[(0,_.jsx)(`h1`,{children:`消息`}),(0,_.jsx)(oe,{className:`assistant-new-chat`,icon:`plus`,label:`新建对话`,disabled:V,onClick:()=>void ge(),"data-testid":`assistant-launcher`})]}),(0,_.jsxs)(`div`,{className:`assistant-message-scroll`,children:[D.loading&&!D.data&&(0,_.jsx)(`p`,{className:`assistant-list-status`,role:`status`,children:`加载中…`}),D.data?.chats.map(e=>(0,_.jsxs)(`button`,{type:`button`,"data-testid":`assistant-chat-${e.id}`,className:`assistant-message-item assistant-chat-item ${k===e.id?`selected`:``}`,"aria-pressed":k===e.id,onClick:()=>void $(`chat:${e.id}`),children:[(0,_.jsx)(`span`,{className:`assistant-message-dot ${e.unread||e.state===`running`||e.state===`queued`?`unread`:``}`}),(0,_.jsxs)(`span`,{className:`assistant-message-copy`,children:[(0,_.jsx)(u,{selected:k===e.id,children:(0,_.jsx)(`strong`,{children:e.title})}),(0,_.jsxs)(`time`,{dateTime:e.updatedAt,children:[new Date(e.updatedAt).toLocaleDateString([],{month:`numeric`,day:`numeric`}),` `,v(e.updatedAt)]})]})]},e.id)),!!X.length&&(0,_.jsxs)(`button`,{type:`button`,"data-testid":`debug-outbox`,className:`assistant-message-item ${O===`debug`?`selected`:``}`,onClick:()=>void $(`debug`),children:[(0,_.jsx)(`span`,{className:`assistant-message-dot ${Q?`unread`:``}`}),(0,_.jsxs)(`span`,{className:`assistant-message-copy`,children:[(0,_.jsx)(u,{selected:O===`debug`,children:(0,_.jsx)(`strong`,{children:`运行提醒`})}),(0,_.jsx)(`span`,{children:y(X.at(-1).body)})]})]}),E.data?.messages.filter(e=>e.box!==`debug`&&!e.conversationId).sort((e,t)=>Number(!!e.archivedAt)-Number(!!t.archivedAt)).map(e=>(0,_.jsxs)(`button`,{type:`button`,"data-testid":`outbox-${e.id}`,className:`assistant-message-item ${e.archivedAt?`archived`:``} ${O===e.id?`selected`:``}`,onClick:()=>void $(e.id),children:[(0,_.jsx)(`span`,{className:`assistant-message-dot ${e.readAt?``:`unread`}`}),(0,_.jsxs)(`span`,{className:`assistant-message-copy`,children:[(0,_.jsx)(u,{selected:O===e.id,children:(0,_.jsx)(`strong`,{children:y(e.body)})}),(0,_.jsxs)(`time`,{dateTime:e.createdAt,children:[new Date(e.createdAt).toLocaleDateString([],{month:`numeric`,day:`numeric`}),` `,v(e.createdAt)]})]})]},e.id))]}),(0,_.jsx)(o,{error:!0,children:E.error||D.error})]}),(0,_.jsxs)(`section`,{className:`assistant-thread`,"aria-label":A?`Tim对话`:`消息内容`,children:[(0,_.jsxs)(`header`,{className:`assistant-thread-heading`,children:[(0,_.jsx)(`h2`,{children:A?de?.title??N?.title??(k?`无标题`:`Tim`):O===`debug`?`运行提醒`:`项目消息`}),N?.kind===`matter`&&(0,_.jsxs)(`span`,{className:`assistant-participants`,title:N.participants?.join(`、`),children:[N.visibility===`project`?`项目共享 · `:``,N.participants?.join(`、`)]})]}),N?.kind===`matter`&&(N.hold||N.pending||N.status===`completed`)&&(0,_.jsx)(`div`,{className:`assistant-matter-state`,role:`status`,children:N.hold?`${N.hold.scope===`all`?`已暂停`:`暂缓修改`} · ${N.hold.reason}`:N.pending?`待确认 · ${N.pending.members.join(`、`)}:${N.pending.question}`:`已完成`}),(0,_.jsxs)(`div`,{className:`assistant-transcript`,role:`log`,"aria-live":`polite`,"data-testid":`assistant-transcript`,onScroll:e=>{let t=e.currentTarget;q.current=t.scrollHeight-t.scrollTop-t.clientHeight<100},children:[A?ye?(0,_.jsxs)(`div`,{className:`assistant-empty`,"data-testid":`assistant-loading`,children:[(0,_.jsx)(l,{}),(0,_.jsx)(`p`,{role:`status`,children:W||D.error?`暂时无法加载对话`:`加载中…`})]}):N?.messages.length?N.messages.filter(e=>e.body||[`queued`,`running`,`failed`].includes(e.state)).map(t=>(0,_.jsx)(`div`,{className:`assistant-turn`,children:(0,_.jsxs)(b,{mine:t.role===`user`&&t.author===e,author:`${t.role===`assistant`?`Tim`:t.author}${t.source===`wecom`?` · 企业微信`:``}`,time:t.createdAt,children:[t.body&&(0,_.jsx)(`div`,{className:`markdown`,children:(0,_.jsx)(se,{children:t.body})}),t.role===`assistant`&&[`queued`,`running`].includes(t.state)&&(0,_.jsxs)(`span`,{className:`assistant-typing`,"aria-label":`正在回答`,children:[(0,_.jsx)(`i`,{}),(0,_.jsx)(`i`,{}),(0,_.jsx)(`i`,{})]}),t.state===`failed`&&(0,_.jsx)(o,{error:!0,children:N.runs.find(e=>e.id===t.runId)?.error||`本次回答未完成。`})]})},t.id)):(0,_.jsxs)(`div`,{className:`assistant-empty`,children:[(0,_.jsx)(l,{}),(0,_.jsx)(`p`,{children:`有什么项目问题想聊聊?`})]}):!E.data&&E.loading?(0,_.jsx)(`div`,{className:`assistant-empty`,children:(0,_.jsx)(`p`,{role:`status`,children:`加载中…`})}):O===`debug`?X.map(e=>(0,_.jsx)(S,{item:e,onReply:e.archivedAt?void 0:()=>{P(e.id),R(``),U(``)}},e.id)):Z&&(0,_.jsx)(S,{item:Z}),(0,_.jsx)(`div`,{ref:me})]}),(0,_.jsx)(o,{error:!0,children:pe||(A?W:``)}),ve?(0,_.jsxs)(`form`,{className:`assistant-composer`,onSubmit:e=>void _e(e),children:[(0,_.jsx)(`textarea`,{value:L,disabled:V,onChange:e=>R(e.target.value),"aria-label":A?`向Tim提问`:`回复消息`,placeholder:A?`问问Tim…`:`回复…`,rows:2,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,_.jsx)(`button`,{className:`primary assistant-send`,type:`submit`,disabled:z||V||ye||!L.trim(),"aria-label":`发送`,children:(0,_.jsx)(ae,{name:`send`})})]}):O!==`debug`&&Z&&(0,_.jsxs)(`div`,{className:`assistant-archived`,children:[(0,_.jsx)(ae,{name:`archive`}),`已归档`]})]})]})}function S({item:e,onReply:t}){return(0,_.jsx)(`div`,{"data-testid":`outbox-thread-${e.id}`,children:(0,_.jsxs)(b,{author:e.box===`debug`?`运行提醒`:`Tim`,time:e.createdAt,children:[(0,_.jsx)(`div`,{className:`markdown`,children:(0,_.jsx)(se,{children:e.body})}),t&&(0,_.jsx)(`button`,{type:`button`,className:`assistant-debug-reply`,onClick:t,children:`回复`})]})})}export{x as Assistant};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,A as t,C as n,D as r,E as i,M as a,O as o,S as s,T as c,_ as l,et as u,h as d,m as f,p,u as m,v as h,x as g,y as _}from"./index-
|
|
1
|
+
import{$ as e,A as t,C as n,D as r,E as i,M as a,O as o,S as s,T as c,_ as l,et as u,h as d,m as f,p,u as m,v as h,x as g,y as _}from"./index-DouLQdFE.js";import{t as v}from"./project-links-XbF78Bal.js";import"./file-links-bWpY4fpg.js";var y=e(),b=t(),x=[{status:`planned`,label:`计划`},{status:`in_progress`,label:`进行中`},{status:`in_review`,label:`待验收`},{status:`completed`,label:`已完成`},{status:null,label:`未明确`}];function S({members:e,project:t}){let{request:i,projectId:a}=m(),c=(0,y.useCallback)(e=>i(`tasks`,p,{signal:e}),[i]),l=r(c,3e3,o(a,`tasks`)),[u,f]=(0,y.useState)(),h=l.data,g=new Map(e.map(e=>[e.id,e.displayName||e.id]));return(0,b.jsxs)(`div`,{className:`task-board`,children:[(0,b.jsx)(n,{title:t?.projectName.trim()?`${t.projectName.trim()}|工作看板`:`工作看板`,description:t?.description.trim()||``}),(0,b.jsx)(s,{error:!0,children:l.error}),(0,b.jsx)(`section`,{className:`task-board-lanes`,"aria-label":`任务进度`,"data-testid":`progress-board`,children:x.filter(e=>e.status!==null||h?.tasks.some(e=>e.status===null)).map(e=>{let t=h?.tasks.filter(t=>t.status===e.status)??[];return(0,b.jsxs)(`section`,{className:`task-lane`,"aria-label":e.label,"data-stage":e.status??`unknown`,children:[(0,b.jsxs)(`h2`,{children:[(0,b.jsx)(`span`,{className:`lane-dot`}),e.label,(0,b.jsx)(d,{children:h?t.length:`—`})]}),(0,b.jsx)(`div`,{className:`task-lane-content`,children:t.length?t.map(e=>(0,b.jsx)(C,{task:e,names:g,onEdit:()=>f(e),onSaved:()=>void l.reload()},e.id)):(0,b.jsx)(`p`,{className:`task-lane-empty`,children:l.error&&!h?`读取失败`:h?`暂无任务`:`读取中…`})})]},e.label)})}),u&&(0,b.jsx)(T,{task:u,onClose:()=>f(void 0),onSaved:()=>{f(void 0),l.reload()}},u.id)]})}function C({task:e,names:t,onEdit:n,onSaved:r}){let{projectId:o,request:l}=m(),d=i(),[p,g]=(0,y.useState)(!1),[x,S]=(0,y.useState)(``);async function C(){if(!p){g(!0),S(``);try{await l(`tasks/${e.id}/correction`,f,{method:`PATCH`,signal:d,body:{needsConfirmation:!1,expectedRevision:e.revision}}),d.aborted||r()}catch(e){d.aborted||S(a(e))}finally{g(!1)}}}return(0,b.jsxs)(`details`,{className:`task-card`,"data-testid":`task-card`,"data-task-id":e.id,"data-owner":e.owner,"data-status":e.status??`unknown`,children:[(0,b.jsxs)(`summary`,{className:`task-card-heading`,"data-testid":`task-toggle`,children:[(0,b.jsx)(`h3`,{children:e.title}),(0,b.jsxs)(`span`,{className:`task-card-meta`,children:[(0,b.jsx)(`small`,{children:t.get(e.owner)??e.owner}),e.needsConfirmation&&(0,b.jsxs)(`span`,{className:`task-confirmation`,"data-testid":`task-confirmation`,children:[(0,b.jsx)(h,{name:`attention`,size:`small`}),`需要确认`]})]})]}),(0,b.jsx)(_,{icon:`edit`,className:`task-card-edit`,label:`纠正任务:${e.title}`,"data-testid":`task-correct`,disabled:p,onClick:n}),(0,b.jsxs)(`div`,{className:`task-card-details`,children:[e.corrected&&!e.needsConfirmation&&(0,b.jsx)(`small`,{children:`已确认`}),e.needsReview&&(0,b.jsx)(`p`,{children:`本次整理未能明确对应,请核对来源。`}),(0,b.jsx)(`h4`,{children:`目标`}),(0,b.jsx)(`p`,{children:e.goal?(0,b.jsx)(w,{value:e.goal,names:t}):`目标未明确`}),(0,b.jsx)(`h4`,{children:`当前进展`}),(0,b.jsx)(`p`,{className:`task-progress`,children:(0,b.jsx)(w,{value:e.progress,names:t})}),(0,b.jsx)(`div`,{className:`task-card-sources`,children:e.sources.map(t=>(0,b.jsxs)(`a`,{"data-testid":`task-source`,href:u(t.kind===`material`?`/projects/${o}/materials?id=${t.materialId}&revision=${t.revision}`:v(o,e.owner,t.path)),children:[(0,b.jsx)(h,{name:`file`,size:`small`}),(0,b.jsx)(`span`,{children:t.path})]},t.path))}),e.syncedAt&&(0,b.jsxs)(`small`,{children:[`资料同步于 `,(0,b.jsx)(c,{value:e.syncedAt})]}),e.needsConfirmation&&(0,b.jsxs)(`div`,{className:`task-card-confirm`,children:[(0,b.jsx)(s,{error:!0,children:x}),(0,b.jsx)(`button`,{className:`primary`,"data-testid":`task-confirm-save`,disabled:p,onClick:()=>void C(),children:p?`正在保存…`:`保存`})]})]})]})}function w({value:e,names:t}){return e.split(/(@[a-z][a-z0-9_-]*)/gi).map((e,n)=>e.startsWith(`@`)&&t.has(e.slice(1))?(0,b.jsx)(`mark`,{className:`task-mention`,children:e},n):e)}function T({task:e,onClose:t,onSaved:n}){let{request:r}=m(),o=i(),[c,u]=(0,y.useState)(e.title),[d,p]=(0,y.useState)(e.status??``),[h,_]=(0,y.useState)(e.goal??``),[v,S]=(0,y.useState)(e.progress),[C,w]=(0,y.useState)(!1),[T,E]=(0,y.useState)(``),D={...c===e.title?{}:{title:c},...d===(e.status??``)?{}:{status:d||null},...h===(e.goal??``)?{}:{goal:h||null},...v===e.progress?{}:{progress:v},...e.needsConfirmation?{needsConfirmation:!1}:{}};async function O(t=!1){if(!(C||!t&&!Object.keys(D).length)){w(!0),E(``);try{await r(`tasks/${e.id}/correction`,f,{method:t?`DELETE`:`PATCH`,signal:o,...t?{}:{body:{...D,expectedRevision:e.revision}}}),o.aborted||n()}catch(e){o.aborted||E(a(e))}finally{w(!1)}}}return(0,b.jsx)(g,{id:`task-correction`,title:`纠正任务`,onClose:t,children:(0,b.jsxs)(`form`,{className:`stack`,"aria-busy":C,onSubmit:e=>{e.preventDefault(),O()},children:[(0,b.jsx)(l,{id:`task-title`,label:`标题`,children:(0,b.jsx)(`input`,{value:c,required:!0,onChange:e=>u(e.target.value)})}),(0,b.jsxs)(`fieldset`,{className:`task-status-field`,disabled:C,children:[(0,b.jsx)(`legend`,{children:`状态`}),(0,b.jsx)(`div`,{className:`task-status-options`,"data-testid":`task-status`,children:x.filter(e=>e.status!==null).map(e=>(0,b.jsxs)(`label`,{className:`task-status-choice`,children:[(0,b.jsx)(`input`,{type:`radio`,name:`task-status`,value:e.status,checked:d===e.status,onChange:()=>p(e.status)}),(0,b.jsx)(`span`,{children:e.label})]},e.status))})]}),(0,b.jsx)(l,{id:`task-goal`,label:`目标`,children:(0,b.jsx)(`textarea`,{value:h,onChange:e=>_(e.target.value)})}),(0,b.jsx)(l,{id:`task-progress`,label:`当前进展`,children:(0,b.jsx)(`textarea`,{value:v,onChange:e=>S(e.target.value)})}),(0,b.jsx)(s,{error:!0,children:T}),(0,b.jsxs)(`div`,{className:`row wrap`,children:[(0,b.jsx)(`button`,{type:`submit`,className:`primary`,disabled:C||!Object.keys(D).length,"data-testid":`task-correction-save`,children:`保存`}),e.corrected&&e.jobId&&(0,b.jsx)(`button`,{type:`button`,disabled:C,"data-testid":`task-correction-reset`,onClick:()=>void O(!0),children:`恢复自动结果`})]})]})})}function E({members:e,config:t}){return(0,b.jsx)(S,{members:e,project:t})}export{E as Dashboard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,A as t,D as n,F as r,L as i,O as a,S as o,c as s,et as c,g as l,j as u,l as d,s as f,u as p,v as m,w as h,y as g}from"./index-
|
|
1
|
+
import{$ as e,A as t,D as n,F as r,L as i,O as a,S as o,c as s,et as c,g as l,j as u,l as d,s as f,u as p,v as m,w as h,y as g}from"./index-DouLQdFE.js";import{t as _}from"./Markdown-TnAER8HW.js";import{t as v}from"./project-links-XbF78Bal.js";import{t as y}from"./file-links-bWpY4fpg.js";import{n as b,t as x}from"./WorkspaceTree-DN1U-aDQ.js";var S=e(),C=t();function w(e,t){let n=t.split(`/`).slice(0,-1);return n.map((t,r)=>b(e,n.slice(0,r+1).join(`/`))).concat(b(e,``))}function T({members:e,me:t,onRefresh:a}){let{api:m,projectId:h}=p(),[_,T]=(0,S.useState)(()=>{let t=new URLSearchParams(location.search),n=t.get(`owner`),r=i.safeParse(t.get(`path`));return n&&(n===`_project`||e.some(e=>e.id===n))&&r.success&&!s(r.data)?{owner:n,path:r.data}:void 0}),[D,O]=(0,S.useState)(()=>new Set(_?w(_.owner,_.path):[b(t,``)])),[k,A]=(0,S.useState)(()=>_?{..._,kind:`file`}:void 0),[j,M]=(0,S.useState)(0),[N,P]=(0,S.useState)(()=>{let e=new URLSearchParams(location.search);return!_&&(e.has(`owner`)||e.has(`path`))?`文件链接不完整或目标已不可用。`:``}),F=(0,S.useCallback)(async e=>{if(_)try{return{owner:_.owner,...await m.file(_.owner,_.path,void 0,e)}}catch(e){throw e instanceof u&&e.code===`FILE_NOT_FOUND`?Error(`找不到这个文件,可能已被删除或移动。`):e}},[_?.owner,_?.path,j]),I=n(F),L=I.data?.owner===_?.owner&&I.data?.file.path===_?.path?I.data:void 0;function R(e,t){let n=t.split(`/`).filter(Boolean);O(t=>{let r=new Set(t);for(let t=0;t<=n.length;t++)r.add(b(e,n.slice(0,t).join(`/`)));return r})}function z(e,t){P(``),R(e,t.split(`/`).slice(0,-1).join(`/`)),T({owner:e,path:t}),A({owner:e,path:t,kind:`file`}),history.replaceState(null,``,c(v(h,e,t)))}function B(t){if(!_)return!1;let n=y(_.owner===`_project`?_.path:`${_.owner}/${_.path}`,t);if(!n)return!/^[a-z][a-z0-9+.-]*:/i.test(t)&&!t.startsWith(`//`)&&(P(`该链接超出工作区,请在原仓库查看。`),!0);if(s(n.path))return P(`配置文件不在文件浏览中显示。`),!0;let[r,...i]=n.path.split(`/`),a=e.some(e=>e.id===r),o=a?r:f,c=a?i.join(`/`):n.path;return P(``),n.directory?(R(o,c),A({owner:o,path:c,kind:`directory`})):o===_.owner&&c===_.path?n.anchor&&[...document.querySelectorAll(`.markdown h1,.markdown h2,.markdown h3,.markdown h4`)].find(e=>e.textContent?.trim().toLowerCase().replace(/\s+/g,`-`)===n.anchor.toLowerCase())?.scrollIntoView({block:`center`}):z(o,c),!0}return(0,C.jsxs)(`div`,{className:`split-layout file-explorer`,"data-testid":`file-browser`,children:[(0,C.jsxs)(`aside`,{className:`file-tree-pane`,"aria-label":`文件资源管理器`,children:[(0,C.jsx)(d,{title:`工作区`,icon:`files`,children:(0,C.jsx)(g,{icon:`refresh`,label:`刷新文件`,"data-testid":`files-refresh`,onClick:()=>{P(``),M(e=>e+1),a()}})}),(0,C.jsx)(x,{members:e,expanded:D,selected:k,revealed:!I.loading&&!I.error&&L?{owner:L.owner,path:L.file.path,file:L.file}:void 0,onSelect:z,onToggle:(e,t)=>{A({owner:e,path:t,kind:`directory`}),O(n=>{let r=new Set(n),i=b(e,t);return r.has(i)?r.delete(i):r.add(i),r})}},j)]}),(0,C.jsx)(`section`,{className:`file-detail`,"data-testid":`file-preview`,"data-owner-id":_?.owner,"data-file-path":_?.path,"aria-label":r.filePreview,children:_?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(o,{error:!0,children:N||!I.loading&&I.error}),I.error&&(0,C.jsx)(`button`,{className:`file-entry-retry`,"data-testid":`files-retry`,onClick:()=>void I.reload(),children:r.retry}),I.loading?(0,C.jsx)(`p`,{className:`preview-body`,role:`status`,children:r.loading}):!I.error&&L&&(0,C.jsx)(E,{owner:L.owner,file:L.file,onLink:B},`${L.owner}:${L.file.path}:${L.file.sha256}`)]}):N?(0,C.jsx)(o,{error:!0,children:N}):(0,C.jsx)(l,{mascot:!0,title:`从一份资料开始`,description:r.pickFile})})]})}function E({owner:e,file:t,onLink:i}){let{readTextBlob:s,blobUrl:c,projectId:l}=p(),[u,d]=(0,S.useState)(!1),f=t.size>524288,v=/\.(md|markdown)$/i.test(t.path),y=(0,S.useCallback)(e=>f?Promise.resolve(void 0):s(t,e),[t.sha256,t.size,f]),b=n(y,!1,a(l,`file-body`,t.sha256));return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`header`,{className:`file-detail-header`,children:[(0,C.jsxs)(`span`,{className:`file-detail-path`,title:`${e===`_project`?`workspaces`:e}/${t.path}`,children:[(0,C.jsxs)(`span`,{children:[e===`_project`?`workspaces`:e,` / `]}),t.path]}),(0,C.jsxs)(h,{label:`文件操作`,children:[v&&(0,C.jsx)(g,{icon:u?`preview`:`code`,label:u?`切换为预览`:`切换为原文`,"data-testid":`file-toggle-raw`,"aria-pressed":u,onClick:()=>d(!u)}),(0,C.jsx)(`a`,{className:`icon-button`,"data-testid":`file-download`,"aria-label":r.download,title:r.download,href:c(t.sha256),download:t.path.split(`/`).at(-1),children:(0,C.jsx)(m,{name:`download`})})]})]}),f?(0,C.jsx)(`div`,{className:`empty`,children:(0,C.jsx)(`p`,{children:r.previewLarge})}):b.error?(0,C.jsxs)(`div`,{className:`preview-body`,children:[(0,C.jsx)(o,{error:!0,children:b.error}),(0,C.jsx)(`button`,{"data-testid":`file-preview-retry`,onClick:()=>void b.reload(),children:r.retry})]}):b.loading?(0,C.jsx)(`p`,{className:`preview-body`,role:`status`,children:r.loading}):(0,C.jsx)(`div`,{className:`preview-body`,children:v&&!u?(0,C.jsx)(`article`,{className:`markdown`,"data-testid":`file-content`,"data-format":`markdown`,children:(0,C.jsx)(_,{onLink:i,children:b.data??``})}):(0,C.jsx)(`pre`,{className:`raw`,"data-testid":`file-content`,"data-format":`text`,children:b.data})})]})}export{T as Files};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e,A as t,F as n,et as r,nt as i,rt as a,tt as o}from"./index-DQsx-e5d.js";function s(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var c=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,l=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,u={};function d(e,t){return((t||u).jsx?l:c).test(e)}var f=/[ \t\n\f\r]/g;function p(e){return typeof e==`object`?e.type===`text`&&m(e.value):m(e)}function m(e){return e.replace(f,``)===``}var h=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};h.prototype.normal={},h.prototype.property={},h.prototype.space=void 0;function g(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new h(n,r,t)}function _(e){return e.toLowerCase()}var v=class{constructor(e,t){this.attribute=t,this.property=e}};v.prototype.attribute=``,v.prototype.booleanish=!1,v.prototype.boolean=!1,v.prototype.commaOrSpaceSeparated=!1,v.prototype.commaSeparated=!1,v.prototype.defined=!1,v.prototype.mustUseProperty=!1,v.prototype.number=!1,v.prototype.overloadedBoolean=!1,v.prototype.property=``,v.prototype.spaceSeparated=!1,v.prototype.space=void 0;var y=i({boolean:()=>x,booleanish:()=>S,commaOrSpaceSeparated:()=>D,commaSeparated:()=>E,number:()=>w,overloadedBoolean:()=>C,spaceSeparated:()=>T}),b=0,x=O(),S=O(),C=O(),w=O(),T=O(),E=O(),D=O();function O(){return 2**++b}var k=Object.keys(y),A=class extends v{constructor(e,t,n,r){let i=-1;if(super(e,t),ee(this,`space`,r),typeof n==`number`)for(;++i<k.length;){let e=k[i];ee(this,k[i],(n&y[e])===y[e])}}};A.prototype.defined=!0;function ee(e,t,n){n&&(e[t]=n)}function j(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new A(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[_(r)]=r,n[_(a.attribute)]=r}return new h(t,n,e.space)}var M=j({properties:{ariaActiveDescendant:null,ariaAtomic:S,ariaAutoComplete:null,ariaBusy:S,ariaChecked:S,ariaColCount:w,ariaColIndex:w,ariaColSpan:w,ariaControls:T,ariaCurrent:null,ariaDescribedBy:T,ariaDetails:null,ariaDisabled:S,ariaDropEffect:T,ariaErrorMessage:null,ariaExpanded:S,ariaFlowTo:T,ariaGrabbed:S,ariaHasPopup:null,ariaHidden:S,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:T,ariaLevel:w,ariaLive:null,ariaModal:S,ariaMultiLine:S,ariaMultiSelectable:S,ariaOrientation:null,ariaOwns:T,ariaPlaceholder:null,ariaPosInSet:w,ariaPressed:S,ariaReadOnly:S,ariaRelevant:null,ariaRequired:S,ariaRoleDescription:T,ariaRowCount:w,ariaRowIndex:w,ariaRowSpan:w,ariaSelected:S,ariaSetSize:w,ariaSort:null,ariaValueMax:w,ariaValueMin:w,ariaValueNow:w,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function te(e,t){return t in e?e[t]:t}function ne(e,t){return te(e,t.toLowerCase())}var N=j({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:E,acceptCharset:T,accessKey:T,action:null,allow:null,allowFullScreen:x,allowPaymentRequest:x,allowUserMedia:x,alpha:x,alt:null,as:null,async:x,autoCapitalize:null,autoComplete:T,autoFocus:x,autoPlay:x,blocking:T,capture:null,charSet:null,checked:x,cite:null,className:T,closedBy:null,colorSpace:null,cols:w,colSpan:w,command:null,commandFor:null,content:null,contentEditable:S,controls:x,controlsList:T,coords:w|E,crossOrigin:null,data:null,dateTime:null,decoding:null,default:x,defer:x,dir:null,dirName:null,disabled:x,download:C,draggable:S,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:x,formTarget:null,headers:T,height:w,hidden:C,high:w,href:null,hrefLang:null,htmlFor:T,httpEquiv:T,id:null,imageSizes:null,imageSrcSet:null,inert:x,inputMode:null,integrity:null,is:null,isMap:x,itemId:null,itemProp:T,itemRef:T,itemScope:x,itemType:T,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:x,low:w,manifest:null,max:null,maxLength:w,media:null,method:null,min:null,minLength:w,multiple:x,muted:x,name:null,nonce:null,noModule:x,noValidate:x,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:x,optimum:w,pattern:null,ping:T,placeholder:null,playsInline:x,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:x,referrerPolicy:null,rel:T,required:x,reversed:x,rows:w,rowSpan:w,sandbox:T,scope:null,scoped:x,seamless:x,selected:x,shadowRootClonable:x,shadowRootCustomElementRegistry:x,shadowRootDelegatesFocus:x,shadowRootMode:null,shadowRootSerializable:x,shape:null,size:w,sizes:null,slot:null,span:w,spellCheck:S,src:null,srcDoc:null,srcLang:null,srcSet:null,start:w,step:null,style:null,tabIndex:w,target:null,title:null,translate:null,type:null,typeMustMatch:x,useMap:null,value:S,width:w,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:T,axis:null,background:null,bgColor:null,border:w,borderColor:null,bottomMargin:w,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:x,declare:x,event:null,face:null,frame:null,frameBorder:null,hSpace:w,leftMargin:w,link:null,longDesc:null,lowSrc:null,marginHeight:w,marginWidth:w,noResize:x,noHref:x,noShade:x,noWrap:x,object:null,profile:null,prompt:null,rev:null,rightMargin:w,rules:null,scheme:null,scrolling:S,standby:null,summary:null,text:null,topMargin:w,valueType:null,version:null,vAlign:null,vLink:null,vSpace:w,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:x,disablePictureInPicture:x,disableRemotePlayback:x,exportParts:E,part:T,prefix:null,property:null,results:w,security:null,unselectable:null},space:`html`,transform:ne}),re=j({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:D,accentHeight:w,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:w,amplitude:w,arabicForm:null,ascent:w,attributeName:null,attributeType:null,azimuth:w,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:w,by:null,calcMode:null,capHeight:w,className:T,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:w,diffuseConstant:w,direction:null,display:null,dur:null,divisor:w,dominantBaseline:null,download:x,dx:null,dy:null,edgeMode:null,editable:null,elevation:w,enableBackground:null,end:null,event:null,exponent:w,externalResourcesRequired:null,fill:null,fillOpacity:w,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:E,g2:E,glyphName:E,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:w,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:w,horizOriginX:w,horizOriginY:w,id:null,ideographic:w,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:w,k:w,k1:w,k2:w,k3:w,k4:w,kernelMatrix:D,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:w,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:w,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:w,overlineThickness:w,paintOrder:null,panose1:null,path:null,pathLength:w,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:T,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:w,pointsAtY:w,pointsAtZ:w,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:D,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:D,rev:D,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:D,requiredFeatures:D,requiredFonts:D,requiredFormats:D,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:w,specularExponent:w,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:w,strikethroughThickness:w,string:null,stroke:null,strokeDashArray:D,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:w,strokeOpacity:w,strokeWidth:null,style:null,surfaceScale:w,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:D,tabIndex:w,tableValues:null,target:null,targetX:w,targetY:w,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:D,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:w,underlineThickness:w,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:w,values:null,vAlphabetic:w,vMathematical:w,vectorEffect:null,vHanging:w,vIdeographic:w,version:null,vertAdvY:w,vertOriginX:w,vertOriginY:w,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:w,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:te}),ie=j({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),ae=j({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:ne}),oe=j({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),se={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},ce=/[A-Z]/g,le=/-[a-z]/g,ue=/^data[-\w.:]+$/i;function de(e,t){let n=_(t),r=t,i=v;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&ue.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(le,pe);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!le.test(e)){let n=e.replace(ce,fe);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=A}return new i(r,t)}function fe(e){return`-`+e.toLowerCase()}function pe(e){return e.charAt(1).toUpperCase()}var me=g([M,N,ie,ae,oe],`html`),he=g([M,re,ie,ae,oe],`svg`);function ge(e){return e.join(` `).trim()}var _e=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
1
|
+
import{$ as e,A as t,F as n,et as r,nt as i,rt as a,tt as o}from"./index-DouLQdFE.js";function s(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var c=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,l=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,u={};function d(e,t){return((t||u).jsx?l:c).test(e)}var f=/[ \t\n\f\r]/g;function p(e){return typeof e==`object`?e.type===`text`&&m(e.value):m(e)}function m(e){return e.replace(f,``)===``}var h=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};h.prototype.normal={},h.prototype.property={},h.prototype.space=void 0;function g(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new h(n,r,t)}function _(e){return e.toLowerCase()}var v=class{constructor(e,t){this.attribute=t,this.property=e}};v.prototype.attribute=``,v.prototype.booleanish=!1,v.prototype.boolean=!1,v.prototype.commaOrSpaceSeparated=!1,v.prototype.commaSeparated=!1,v.prototype.defined=!1,v.prototype.mustUseProperty=!1,v.prototype.number=!1,v.prototype.overloadedBoolean=!1,v.prototype.property=``,v.prototype.spaceSeparated=!1,v.prototype.space=void 0;var y=i({boolean:()=>x,booleanish:()=>S,commaOrSpaceSeparated:()=>D,commaSeparated:()=>E,number:()=>w,overloadedBoolean:()=>C,spaceSeparated:()=>T}),b=0,x=O(),S=O(),C=O(),w=O(),T=O(),E=O(),D=O();function O(){return 2**++b}var k=Object.keys(y),A=class extends v{constructor(e,t,n,r){let i=-1;if(super(e,t),ee(this,`space`,r),typeof n==`number`)for(;++i<k.length;){let e=k[i];ee(this,k[i],(n&y[e])===y[e])}}};A.prototype.defined=!0;function ee(e,t,n){n&&(e[t]=n)}function j(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new A(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[_(r)]=r,n[_(a.attribute)]=r}return new h(t,n,e.space)}var M=j({properties:{ariaActiveDescendant:null,ariaAtomic:S,ariaAutoComplete:null,ariaBusy:S,ariaChecked:S,ariaColCount:w,ariaColIndex:w,ariaColSpan:w,ariaControls:T,ariaCurrent:null,ariaDescribedBy:T,ariaDetails:null,ariaDisabled:S,ariaDropEffect:T,ariaErrorMessage:null,ariaExpanded:S,ariaFlowTo:T,ariaGrabbed:S,ariaHasPopup:null,ariaHidden:S,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:T,ariaLevel:w,ariaLive:null,ariaModal:S,ariaMultiLine:S,ariaMultiSelectable:S,ariaOrientation:null,ariaOwns:T,ariaPlaceholder:null,ariaPosInSet:w,ariaPressed:S,ariaReadOnly:S,ariaRelevant:null,ariaRequired:S,ariaRoleDescription:T,ariaRowCount:w,ariaRowIndex:w,ariaRowSpan:w,ariaSelected:S,ariaSetSize:w,ariaSort:null,ariaValueMax:w,ariaValueMin:w,ariaValueNow:w,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function te(e,t){return t in e?e[t]:t}function ne(e,t){return te(e,t.toLowerCase())}var N=j({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:E,acceptCharset:T,accessKey:T,action:null,allow:null,allowFullScreen:x,allowPaymentRequest:x,allowUserMedia:x,alpha:x,alt:null,as:null,async:x,autoCapitalize:null,autoComplete:T,autoFocus:x,autoPlay:x,blocking:T,capture:null,charSet:null,checked:x,cite:null,className:T,closedBy:null,colorSpace:null,cols:w,colSpan:w,command:null,commandFor:null,content:null,contentEditable:S,controls:x,controlsList:T,coords:w|E,crossOrigin:null,data:null,dateTime:null,decoding:null,default:x,defer:x,dir:null,dirName:null,disabled:x,download:C,draggable:S,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:x,formTarget:null,headers:T,height:w,hidden:C,high:w,href:null,hrefLang:null,htmlFor:T,httpEquiv:T,id:null,imageSizes:null,imageSrcSet:null,inert:x,inputMode:null,integrity:null,is:null,isMap:x,itemId:null,itemProp:T,itemRef:T,itemScope:x,itemType:T,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:x,low:w,manifest:null,max:null,maxLength:w,media:null,method:null,min:null,minLength:w,multiple:x,muted:x,name:null,nonce:null,noModule:x,noValidate:x,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:x,optimum:w,pattern:null,ping:T,placeholder:null,playsInline:x,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:x,referrerPolicy:null,rel:T,required:x,reversed:x,rows:w,rowSpan:w,sandbox:T,scope:null,scoped:x,seamless:x,selected:x,shadowRootClonable:x,shadowRootCustomElementRegistry:x,shadowRootDelegatesFocus:x,shadowRootMode:null,shadowRootSerializable:x,shape:null,size:w,sizes:null,slot:null,span:w,spellCheck:S,src:null,srcDoc:null,srcLang:null,srcSet:null,start:w,step:null,style:null,tabIndex:w,target:null,title:null,translate:null,type:null,typeMustMatch:x,useMap:null,value:S,width:w,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:T,axis:null,background:null,bgColor:null,border:w,borderColor:null,bottomMargin:w,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:x,declare:x,event:null,face:null,frame:null,frameBorder:null,hSpace:w,leftMargin:w,link:null,longDesc:null,lowSrc:null,marginHeight:w,marginWidth:w,noResize:x,noHref:x,noShade:x,noWrap:x,object:null,profile:null,prompt:null,rev:null,rightMargin:w,rules:null,scheme:null,scrolling:S,standby:null,summary:null,text:null,topMargin:w,valueType:null,version:null,vAlign:null,vLink:null,vSpace:w,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:x,disablePictureInPicture:x,disableRemotePlayback:x,exportParts:E,part:T,prefix:null,property:null,results:w,security:null,unselectable:null},space:`html`,transform:ne}),re=j({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:D,accentHeight:w,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:w,amplitude:w,arabicForm:null,ascent:w,attributeName:null,attributeType:null,azimuth:w,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:w,by:null,calcMode:null,capHeight:w,className:T,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:w,diffuseConstant:w,direction:null,display:null,dur:null,divisor:w,dominantBaseline:null,download:x,dx:null,dy:null,edgeMode:null,editable:null,elevation:w,enableBackground:null,end:null,event:null,exponent:w,externalResourcesRequired:null,fill:null,fillOpacity:w,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:E,g2:E,glyphName:E,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:w,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:w,horizOriginX:w,horizOriginY:w,id:null,ideographic:w,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:w,k:w,k1:w,k2:w,k3:w,k4:w,kernelMatrix:D,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:w,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:w,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:w,overlineThickness:w,paintOrder:null,panose1:null,path:null,pathLength:w,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:T,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:w,pointsAtY:w,pointsAtZ:w,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:D,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:D,rev:D,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:D,requiredFeatures:D,requiredFonts:D,requiredFormats:D,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:w,specularExponent:w,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:w,strikethroughThickness:w,string:null,stroke:null,strokeDashArray:D,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:w,strokeOpacity:w,strokeWidth:null,style:null,surfaceScale:w,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:D,tabIndex:w,tableValues:null,target:null,targetX:w,targetY:w,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:D,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:w,underlineThickness:w,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:w,values:null,vAlphabetic:w,vMathematical:w,vectorEffect:null,vHanging:w,vIdeographic:w,version:null,vertAdvY:w,vertOriginX:w,vertOriginY:w,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:w,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:te}),ie=j({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),ae=j({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:ne}),oe=j({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),se={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},ce=/[A-Z]/g,le=/-[a-z]/g,ue=/^data[-\w.:]+$/i;function de(e,t){let n=_(t),r=t,i=v;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&ue.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(le,pe);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!le.test(e)){let n=e.replace(ce,fe);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=A}return new i(r,t)}function fe(e){return`-`+e.toLowerCase()}function pe(e){return e.charAt(1).toUpperCase()}var me=g([M,N,ie,ae,oe],`html`),he=g([M,re,ie,ae,oe],`svg`);function ge(e){return e.join(` `).trim()}var _e=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
2
2
|
`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),ve=o(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var i=r(_e());function a(e,t){let n=null;if(!e||typeof e!=`string`)return n;let r=(0,i.default)(e),a=typeof t==`function`;return r.forEach(e=>{if(e.type!==`declaration`)return;let{property:r,value:i}=e;a?t(r,i,e):i&&(n||={},n[r]=i)}),n}})),ye=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),be=o(((e,t,n)=>{var r=(n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(ve()),i=ye();function a(e,t){var n={};return!e||typeof e!=`string`||(0,r.default)(e,function(e,r){e&&r&&(n[(0,i.camelCase)(e,t)]=r)}),n}a.default=a,t.exports=a})),xe=Ce(`end`),Se=Ce(`start`);function Ce(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function we(e){let t=Se(e),n=xe(e);if(t&&n)return{start:t,end:n}}function Te(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?De(e.position):`start`in e||`end`in e?De(e):`line`in e||`column`in e?Ee(e):``}function Ee(e){return Oe(e&&e.line)+`:`+Oe(e&&e.column)}function De(e){return Ee(e&&e.start)+`-`+Ee(e&&e.end)}function Oe(e){return e&&typeof e==`number`?e:1}var P=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Te(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};P.prototype.file=``,P.prototype.name=``,P.prototype.reason=``,P.prototype.message=``,P.prototype.stack=``,P.prototype.column=void 0,P.prototype.line=void 0,P.prototype.ancestors=void 0,P.prototype.cause=void 0,P.prototype.fatal=void 0,P.prototype.place=void 0,P.prototype.ruleId=void 0,P.prototype.source=void 0;var ke=a(be(),1),Ae={}.hasOwnProperty,je=new Map,Me=/[A-Z]/g,Ne=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Pe=new Set([`td`,`th`]),Fe=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Ie(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=qe(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Ke(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?he:me,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Le(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Le(e,t,n){if(t.type===`element`)return Re(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return ze(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Ve(e,t,n);if(t.type===`mdxjsEsm`)return Be(e,t);if(t.type===`root`)return He(e,t,n);if(t.type===`text`)return Ue(e,t)}function Re(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=he,e.schema=i),e.ancestors.push(t);let a=$e(e,t.tagName,!1),o=Je(e,t),s=Xe(e,t);return Ne.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!p(e)})),We(e,o,a,t),Ge(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function ze(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}et(e,t.position)}function Be(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);et(e,t.position)}function Ve(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=he,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:$e(e,t.name,!0),o=Ye(e,t),s=Xe(e,t);return We(e,o,a,t),Ge(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function He(e,t,n){let r={};return Ge(r,Xe(e,t)),e.create(t,e.Fragment,r,n)}function Ue(e,t){return t.value}function We(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ge(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Ke(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function qe(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Se(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Je(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Ae.call(t.properties,i)){let a=Ze(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Pe.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Ye(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else et(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else et(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function Xe(e,t){let n=[],r=-1,i=e.passKeys?new Map:je;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Le(e,a,o);s!==void 0&&n.push(s)}return n}function Ze(e,t,n){let r=de(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?s(n):ge(n)),r.property===`style`){let t=typeof n==`object`?n:Qe(e,String(n));return e.stylePropertyNameCase===`css`&&(t=tt(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?se[r.property]||r.property:r.attribute,n]}}function Qe(e,t){try{return(0,ke.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new P("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=Fe+`#cannot-parse-style-attribute`,r}}function $e(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=d(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=d(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Ae.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);et(e)}function et(e,t){let n=new P("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=Fe+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function tt(e){let t={},n;for(n in e)Ae.call(e,n)&&(t[nt(n)]=e[n]);return t}function nt(e){let t=e.replace(Me,rt);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function rt(e){return`-`+e.toLowerCase()}var it={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},at={};function ot(e,t){let n=t||at;return st(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function st(e,t,n){if(lt(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return ct(e.children,t,n)}return Array.isArray(e)?ct(e,t,n):``}function ct(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=st(e[i],t,n);return r.join(``)}function lt(e){return!!(e&&typeof e==`object`)}var ut=document.createElement(`i`);function dt(e){let t=`&`+e+`;`;ut.innerHTML=t;let n=ut.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function F(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function I(e,t){return e.length>0?(F(e,e.length,0,t),e):t}var ft={}.hasOwnProperty;function pt(e){let t={},n=-1;for(;++n<e.length;)mt(t,e[n]);return t}function mt(e,t){let n;for(n in t){let r=(ft.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){ft.call(r,a)||(r[a]=[]);let e=i[a];ht(r[a],Array.isArray(e)?e:e?[e]:[])}}}function ht(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);F(e,0,0,r)}function gt(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function L(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var R=W(/[A-Za-z]/),z=W(/[\dA-Za-z]/),_t=W(/[#-'*+\--9=?A-Z^-~]/);function vt(e){return e!==null&&(e<32||e===127)}var yt=W(/\d/),bt=W(/[\dA-Fa-f]/),xt=W(/[!-/:-@[-`{-~]/);function B(e){return e!==null&&e<-2}function V(e){return e!==null&&(e<0||e===32)}function H(e){return e===-2||e===-1||e===32}var St=W(/\p{P}|\p{S}/u),U=W(/\s/);function W(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Ct(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&z(e.charCodeAt(n+1))&&z(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function G(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return H(r)?(e.enter(n),s(r)):t(r)}function s(r){return H(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}function wt(e,t,n,r,i,a){let o=0;return s;function s(t){return a>0&&H(t)?(e.enter(r),c(t)):l(t)}function c(t){return H(t)&&o<a?(e.consume(t),o++,c):(e.exit(r),l(t))}function l(e){return o>=i?t(e):n(e)}}var Tt={tokenize:Et};function Et(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null)e.consume(n);else return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),G(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null)e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);else return B(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Dt=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){Ot(this,e,t,n,!1)}addBefore(e,t,n){Ot(this,e,t,n,!0)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function Ot(e,t,n,r,i){if(n===0&&r.length===0)return;let a=e.index.get(t);if(a){a[1]+=n,i?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}let o=[t,n,r];e.map.push(o),e.index.set(t,o)}var kt={tokenize:jt},At={tokenize:Mt};function jt(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;let c=new Dt;return c.add(a+1,0,t.events.slice(n)),c.add(n,s-n,[]),c.consume(t.events),l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!(!i.currentConstruct||i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(At,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(At,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null)i&&v(),_(0),e.consume(n);else return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null)g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);else return B(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;let l=new Dt;l.add(a+1,0,t.events.slice(n)),l.add(n,e-n,[]),l.consume(t.events)}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Mt(e,t,n){return G(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Nt(e){if(e===null||V(e)||U(e))return 1;if(St(e))return 2}function Pt(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var Ft={name:`attention`,resolveAll:It,tokenize:Lt};function It(e,t){let n=-1,r;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){let i=n;for(;i--;)if(e[i][0]===`exit`&&e[i][1].type===`attentionSequence`&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;let a=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,o={...e[i][1].end},s={...e[n][1].start};Rt(o,-a),Rt(s,a);let c={type:a>1?`strongSequence`:`emphasisSequence`,start:o,end:{...e[i][1].end}},l={type:a>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:s},u={type:a>1?`strongText`:`emphasisText`,start:{...e[i][1].end},end:{...e[n][1].start}},d={type:a>1?`strong`:`emphasis`,start:{...c.start},end:{...l.end}};e[i][1].end={...c.start},e[n][1].start={...l.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=I(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=I(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=I(r,Pt(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=I(r,[[`exit`,u,t],[`enter`,l,t],[`exit`,l,t],[`exit`,d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=I(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),F(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Lt(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Nt(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Nt(o),u=!l||l===2&&i||n.includes(o)&&o!==42&&o!==95,d=!i||i===2&&l||n.includes(r)&&r!==42&&r!==95;return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Rt(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var zt={name:`autolink`,tokenize:Bt};function Bt(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return R(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||z(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||z(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||vt(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):_t(t)?(e.consume(t),l):n(t)}function u(e){return z(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||z(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Vt={partial:!0,tokenize:Ht};function Ht(e,t,n){return r;function r(t){return H(t)?G(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||B(e)?t(e):n(e)}}var Ut={continuation:{tokenize:Gt},exit:Kt,name:`blockQuote`,tokenize:Wt};function Wt(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return H(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Gt(e,t,n){let r=this;return i;function i(t){return H(t)?G(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Ut,t,n)(r)}}function Kt(e){e.exit(`blockQuote`)}var qt={name:`characterEscape`,tokenize:Jt};function Jt(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return xt(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Yt={name:`characterReference`,tokenize:Xt};function Xt(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=z,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=bt,u):(e.enter(`characterReferenceValue`),a=7,o=yt,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===z&&!dt(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var Zt={partial:!0,tokenize:Qt};function Qt(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var $t={concrete:!0,name:`codeFenced`,tokenize:en};function en(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),H(t)?G(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||B(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(Zt,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||B(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):H(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),G(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||B(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||B(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&H(t)?G(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||B(t)?e.check(Zt,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||B(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),H(t)?G(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),H(t)?G(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||B(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var tn={name:`codeIndented`,tokenize:rn},nn={partial:!0,tokenize:an};function rn(e,t,n){return r;function r(t){return e.enter(`codeIndented`),wt(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):B(t)?e.attempt(nn,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||B(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function an(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):B(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):wt(e,t,a,`linePrefix`,4,4)(o)}function a(e){return B(e)?i(e):n(e)}}var on={name:`codeText`,previous:cn,resolve:sn,tokenize:ln};function sn(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function cn(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function ln(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):B(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||B(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var un=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&dn(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),dn(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),dn(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);dn(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);dn(this.left,t.reverse())}}}};function dn(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function fn(e){let t={},n=-1,r,i,a,o,s,c,l,u=new un(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,pn(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return F(e,0,1/0,u.slice(0)),!l}function pn(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var mn={resolve:gn,tokenize:_n},hn={partial:!0,tokenize:vn};function gn(e){return fn(e),e}function _n(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):B(t)?e.check(hn,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function vn(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),G(e,a,`linePrefix`)}function a(i){if(i===null||B(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function yn(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||vt(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||B(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||V(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||vt(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function bn(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):B(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||B(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!H(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function xn(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):B(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),G(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||B(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Sn(e,t){let n;return r;function r(i){return B(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):H(i)?G(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Cn={name:`definition`,tokenize:Tn},wn={partial:!0,tokenize:En};function Tn(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return bn.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=L(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return V(t)?Sn(e,l)(t):l(t)}function l(t){return yn(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(wn,d,d)(t)}function d(t){return H(t)?G(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||B(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function En(e,t,n){return r;function r(t){return V(t)?Sn(e,i)(t):n(t)}function i(t){return xn(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return H(t)?G(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||B(e)?t(e):n(e)}}var Dn={name:`hardBreakEscape`,tokenize:On};function On(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return B(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var kn={name:`headingAtx`,resolve:An,tokenize:jn};function An(e,t){let n=e.length-2,r=3;if(e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r){let i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`};F(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function jn(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||V(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||B(n)?(e.exit(`atxHeading`),t(n)):H(n)?G(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||V(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Mn=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),Nn=[`pre`,`script`,`style`,`textarea`],Pn={concrete:!0,name:`htmlFlow`,resolveTo:In,tokenize:Ln},Fn={partial:!0,tokenize:Rn};function In(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Ln(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:N):R(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):R(a)?(e.consume(a),i=4,r.interrupt?t:N):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:N):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return R(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||V(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Nn.includes(l)?(i=1,r.interrupt?t(s):O(s)):Mn.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||z(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return H(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||R(t)?(e.consume(t),b):H(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||z(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):H(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):H(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||B(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||V(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||H(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||B(t)?O(t):H(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),j):t===60&&i===1?(e.consume(t),M):t===62&&i===4?(e.consume(t),re):t===63&&i===3?(e.consume(t),N):t===93&&i===5?(e.consume(t),ne):B(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Fn,ie,k)(t)):t===null||B(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Zt,A,ie)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ee}function ee(t){return t===null||B(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function j(t){return t===45?(e.consume(t),N):O(t)}function M(t){return t===47?(e.consume(t),o=``,te):O(t)}function te(t){if(t===62){let n=o.toLowerCase();return Nn.includes(n)?(e.consume(t),re):O(t)}return R(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),te):O(t)}function ne(t){return t===93?(e.consume(t),N):O(t)}function N(t){return t===62?(e.consume(t),re):t===45&&i===2?(e.consume(t),N):O(t)}function re(t){return t===null||B(t)?(e.exit(`htmlFlowData`),ie(t)):(e.consume(t),re)}function ie(n){return e.exit(`htmlFlow`),t(n)}}function Rn(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Vt,t,n)}}var zn={name:`htmlText`,tokenize:Bn};function Bn(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):R(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):R(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):B(t)?(o=d,M(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?j(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):B(t)?(o=h,M(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?j(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?j(t):B(t)?(o=v,M(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):B(t)?(o=y,M(t)):(e.consume(t),y)}function b(e){return e===62?j(e):y(e)}function x(t){return R(t)?(e.consume(t),S):n(t)}function S(t){return t===45||z(t)?(e.consume(t),S):C(t)}function C(t){return B(t)?(o=C,M(t)):H(t)?(e.consume(t),C):j(t)}function w(t){return t===45||z(t)?(e.consume(t),w):t===47||t===62||V(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),j):t===58||t===95||R(t)?(e.consume(t),E):B(t)?(o=T,M(t)):H(t)?(e.consume(t),T):j(t)}function E(t){return t===45||t===46||t===58||t===95||z(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):B(t)?(o=D,M(t)):H(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):B(t)?(o=O,M(t)):H(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,ee):t===null?n(t):B(t)?(o=k,M(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||V(t)?T(t):(e.consume(t),A)}function ee(e){return e===47||e===62||V(e)?T(e):n(e)}function j(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function M(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return H(t)?G(e,ne,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ne(t)}function ne(t){return e.enter(`htmlTextData`),o(t)}}var Vn={name:`labelEnd`,resolveAll:Gn,resolveTo:Kn,tokenize:qn},Hn={tokenize:Jn},Un={tokenize:Yn},Wn={tokenize:Xn};function Gn(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&F(e,0,e.length,n),e}function Kn(e,t){let n=e.length,r=0,i,a,o;for(;n--;){let t=e[n][1];if(i){if(t.type===`link`||t.type===`labelLink`&&t._inactive)break;e[n][0]===`enter`&&t.type===`labelLink`&&(t._inactive=!0)}else if(a){if(e[n][0]===`enter`&&(t.type===`labelImage`||t.type===`labelLink`)&&!t._balanced&&(i=n,t.type!==`labelLink`)){r=2;break}}else t.type===`labelEnd`&&(a=n)}let s={type:e[i][1].type===`labelLink`?`link`:`image`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:`label`,start:{...e[i][1].start},end:{...e[a][1].end}},l={type:`labelText`,start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return o=[[`enter`,s,t],[`enter`,c,t]],o=I(o,e.slice(i+1,i+r+3)),o=I(o,[[`enter`,l,t]]),o=I(o,Pt(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),o=I(o,[[`exit`,l,t],e[a-2],e[a-1],[`exit`,c,t]]),o=I(o,e.slice(a+1)),o=I(o,[[`exit`,s,t]]),F(e,i,e.length,o),e}function qn(e,t,n){let r=this,i=r._labelStarts,a,o;if(i){for(;i.length>0&&i[i.length-1]._balanced;)i.pop();a=i[i.length-1]}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(L(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Hn,u,o?u:d)(t):t===91?e.attempt(Un,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Wn,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function Jn(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return V(t)?Sn(e,a)(t):a(t)}function a(t){return t===41?u(t):yn(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return V(t)?Sn(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?xn(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return V(t)?Sn(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function Yn(e,t,n){let r=this;return i;function i(t){return bn.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(L(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Xn(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var Zn={name:`labelStartImage`,resolveAll:Vn.resolveAll,tokenize:Qn};function Qn(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),o}function o(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelImage`),s):n(t)}function s(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var $n={name:`labelStartLink`,resolveAll:Vn.resolveAll,tokenize:er};function er(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelLink`),o}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var tr={name:`lineEnding`,tokenize:nr};function nr(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),G(e,t,`linePrefix`)}}var rr={name:`thematicBreak`,tokenize:ir};function ir(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||B(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),H(t)?G(e,s,`whitespace`)(t):s(t))}}var K={continuation:{tokenize:cr},exit:ur,name:`list`,tokenize:sr},ar={partial:!0,tokenize:dr},or={partial:!0,tokenize:lr};function sr(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:yt(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(rr,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return yt(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Vt,r.interrupt?n:u,e.attempt(ar,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return H(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function cr(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Vt,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,G(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!H(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(or,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,G(e,e.attempt(K,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function lr(e,t,n){let r=this;return G(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function ur(e){e.exit(this.containerState.type)}function dr(e,t,n){let r=this;return G(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!H(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var fr={name:`setextUnderline`,resolveTo:pr,tokenize:mr};function pr(e,t){let n=new Dt,r=e.length,i,a,o;for(;r--;)if(e[r][0]===`enter`){if(e[r][1].type===`content`){i=r;break}e[r][1].type===`paragraph`&&(a=r)}else e[r][1].type===`content`&&n.add(r,1,[]),!o&&e[r][1].type===`definition`&&(o=r);let s={type:`setextHeading`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type=`setextHeadingText`,o?(n.add(a,0,[[`enter`,s,t]]),n.add(o+1,0,[[`exit`,e[i][1],t]]),e[i][1].end={...e[o][1].end}):e[i][1]=s,n.add(e.length,0,[[`exit`,s,t]]),n.consume(e),e}function mr(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),H(t)?G(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||B(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var hr={tokenize:gr};function gr(e){let t=this,n=e.attempt(Vt,r,e.attempt(this.parser.constructs.flowInitial,i,G(e,e.attempt(this.parser.constructs.flow,i,e.attempt(mn,i)),`linePrefix`)));return n;function r(r){if(r===null)e.consume(r);else return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null)e.consume(r);else return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var _r={resolveAll:xr()},vr=br(`string`),yr=br(`text`);function br(e){return{resolveAll:xr(e===`text`?Sr:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null)t.consume(e);else return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function xr(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):t[r]&&t[r][1].type===`data`||(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Sr(e,t){let n=new Dt,r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type===`lineEnding`)&&e[r-1][1].type===`data`){let i=e[r-1][1],a=t.sliceStream(i),o=a.length,s=-1,c=0,l;for(;o--;){let e=a[o];if(typeof e==`string`){for(s=e.length;e.charCodeAt(s-1)===32;)c++,s--;if(s)break;s=-1}else if(e===-2)l=!0,c++;else if(e!==-1){o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(c=0),c){let a={type:r===e.length||l||c<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-c,offset:i.end.offset-c},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):n.add(r,0,[[`enter`,a,t],[`exit`,a,t]])}r++}return n.consume(e),e}var Cr=i({attentionMarkers:()=>jr,contentInitial:()=>Tr,disable:()=>Mr,document:()=>wr,flow:()=>Dr,flowInitial:()=>Er,insideSpan:()=>Ar,string:()=>Or,text:()=>kr}),wr={42:K,43:K,45:K,48:K,49:K,50:K,51:K,52:K,53:K,54:K,55:K,56:K,57:K,62:Ut},Tr={91:Cn},Er={[-2]:tn,[-1]:tn,32:tn},Dr={35:kn,42:rr,45:[fr,rr],60:Pn,61:fr,95:rr,96:$t,126:$t},Or={38:Yt,92:qt},kr={[-5]:tr,[-4]:tr,[-3]:tr,33:Zn,38:Yt,42:Ft,60:[zt,zn],91:$n,92:[Dn,qt],93:Vn,95:Ft,96:on},Ar={null:[Ft,_r]},jr={null:[42,95]},Mr={null:[]};function Nr(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=I(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Pt(a,l.events,l),l.events):[]}function f(e,t){return Fr(p(e),t)}function p(e){return Pr(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){for(;r._index<o.length;){let e=o[r._index];if(typeof e==`string`){let t=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===t&&r._bufferIndex<e.length;)_(e.charCodeAt(r._bufferIndex))}else _(e)}}function _(e){u=u(e)}function v(e){B(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&F(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Pr(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Fr(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
3
3
|
`;break;case-3:o=`\r
|
|
4
4
|
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function Ir(e){let t={constructs:pt([Cr,...(e||{}).extensions||[]]),content:n(Tt),defined:[],document:n(kt),flow:n(hr),lazy:{},string:n(vr),text:n(yr)};return t;function n(e){return n;function n(n){return Nr(t,e,n)}}}function Lr(e){for(;!fn(e););return e}var Rr=/[\0\t\n\r]/g;function zr(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i));let s=[],c=0;for(t=``,n&&=(i.charCodeAt(0)===65279&&c++,void 0);c<i.length;){Rr.lastIndex=c;let n=Rr.exec(i),a=n&&n.index!==void 0?n.index:i.length,o=i.charCodeAt(a);if(!n){t=i.slice(c);break}if(o===10&&c===a&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),c<a&&(s.push(i.slice(c,a)),e+=a-c),o){case 0:s.push(65533),e++;break;case 9:{let t=Math.ceil(e/4)*4;for(s.push(-2);e++<t;)s.push(-1);break}case 10:s.push(-4),e=1;break;default:r=!0,e=1}c=a+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var Br=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Vr(e){return e.replace(Br,Hr)}function Hr(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return gt(n.slice(t?2:1),t?16:10)}return dt(n)||e}var Ur={}.hasOwnProperty;function Wr(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Gr(n)(Lr(Ir(n).document().write(zr()(e,t,!0))))}function Gr(e){let t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:o(Se),autolinkProtocol:E,autolinkEmail:E,atxHeading:o(ve),blockQuote:o(pe),characterEscape:E,characterReference:E,codeFenced:o(me),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(me,s),codeText:o(he,s),codeTextData:E,data:E,codeFlowValue:E,definition:o(ge),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(_e),hardBreakEscape:o(ye),hardBreakTrailing:o(ye),htmlFlow:o(be,s),htmlFlowData:E,htmlText:o(be,s),htmlTextData:E,image:o(xe),label:s,link:o(Se),listItem:o(we),listItemValue:p,listOrdered:o(Ce,f),listUnordered:o(Ce),paragraph:o(Ee),reference:oe,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(ve),strong:o(De),thematicBreak:o(P)},exit:{atxHeading:l(),atxHeadingSequence:S,autolink:l(),autolinkEmail:fe,autolinkProtocol:de,blockQuote:l(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:le,characterReference:ue,codeFenced:l(_),codeFencedFence:g,codeFencedFenceInfo:m,codeFencedFenceMeta:h,codeFlowValue:D,codeIndented:l(v),codeText:l(j),codeTextData:D,data:D,definition:l(),definitionDestinationString:x,definitionLabelString:y,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(k),hardBreakTrailing:l(k),htmlFlow:l(A),htmlFlowData:D,htmlText:l(ee),htmlTextData:D,image:l(te),label:N,labelText:ne,lineEnding:O,link:l(M),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:se,resourceDestinationString:re,resourceTitleString:ie,resource:ae,setextHeading:l(T),setextHeadingLineSequence:w,setextHeadingText:C,strong:l(),thematicBreak:l()}};Kr(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[],position:void 0},o={stack:[r],tokenStack:[],config:t,enter:c,exit:u,buffer:s,resume:d,data:n},l=[],f=[],p=-1;for(;++p<e.length;)f.push(e[p]),(e[p][1].type===`listOrdered`||e[p][1].type===`listUnordered`)&&(e[p][0]===`enter`?l.push(f.length-1):a(f,l.pop()));for(e=f,p=-1;++p<e.length;){let n=t[e[p][0]];e[p][0]===`enter`&&t.beforeEnter.length>0&&i(t.beforeEnter,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),Ur.call(n,e[p][1].type)&&n[e[p][1].type].call({...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),e[p][0]===`exit`&&t.afterExit.length>0&&i(t.afterExit,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||Jr).call(o,void 0,e[0])}for(r.position={start:q(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:q(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},p=-1;++p<t.transforms.length;)r=t.transforms[p](r)||r;return r}function i(e,t,n){let r=-1;for(;++r<e.length;)e[r].call(t,n)}function a(e,t){let n=e.length-1,r=t-1,i=-1,a=!1,o,s,c,l,u=[];for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let n=r;for(s=void 0;n--;){let t=e[n];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=n}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),u.push({at:s||r,event:[`exit`,o,t[2]]})}if(t[1].type===`listItemPrefix`){let e={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=e,u.push({at:r,event:[`enter`,e,t[2]]}),c=void 0,l=!0}}}let d=e.splice(t),f=0;for(r=-1;++r<d.length;){for(;f<u.length&&u[f].at===t+r;)e.push(u[f++].event);e.push(d[r])}e[t][1]._spread=a}function o(e,t){return n;function n(n){c.call(this,e(n),n),t&&t.call(this,n)}}function s(){this.stack.push({type:`fragment`,children:[]})}function c(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:q(t.start),end:void 0}}function l(e){return t;function t(t){e&&e.call(this,t),u.call(this,t)}}function u(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw Error("Cannot close `"+e.type+"` ("+Te({start:e.start,end:e.end})+`): it’s not open`);r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||Jr).call(this,e,r[0])),n.position.end=q(e.end)}function d(){return ot(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function h(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function v(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function y(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=L(this.sliceSerialize(e)).toLowerCase()}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function x(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function S(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function C(){this.data.setextHeadingSlurpLineEnding=!0}function w(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function E(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];n&&n.type===`text`||(n=Oe(),n.position={start:q(e.start),end:void 0},t.push(n)),this.stack.push(n)}function D(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=q(e.end)}function O(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=q(e.end),this.data.atHardBreak=void 0}else!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(E.call(this,e),D.call(this,e))}function k(){this.data.atHardBreak=!0}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function te(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ne(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=Vr(t),n.identifier=L(t).toLowerCase()}function N(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function re(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function ie(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ae(){this.data.inReference=void 0}function oe(){this.data.referenceType=`collapsed`}function se(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=L(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ce(e){this.data.characterReferenceType=e.type}function le(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=gt(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=dt(t);let i=this.stack[this.stack.length-1];i.value+=r}function ue(e){let t=this.stack.pop();t.position.end=q(e.end)}function de(e){D.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function fe(e){D.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function pe(){return{type:`blockquote`,children:[],position:void 0}}function me(){return{type:`code`,lang:null,meta:null,value:``,position:void 0}}function he(){return{type:`inlineCode`,value:``,position:void 0}}function ge(){return{type:`definition`,identifier:``,label:null,title:null,url:``,position:void 0}}function _e(){return{type:`emphasis`,children:[],position:void 0}}function ve(){return{type:`heading`,depth:0,children:[],position:void 0}}function ye(){return{type:`break`,position:void 0}}function be(){return{type:`html`,value:``,position:void 0}}function xe(){return{type:`image`,title:null,url:``,alt:null,position:void 0}}function Se(){return{type:`link`,title:null,url:``,children:[],position:void 0}}function Ce(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[],position:void 0}}function we(e){return{type:`listItem`,spread:e._spread,checked:null,children:[],position:void 0}}function Ee(){return{type:`paragraph`,children:[],position:void 0}}function De(){return{type:`strong`,children:[],position:void 0}}function Oe(){return{type:`text`,value:``,position:void 0}}function P(){return{type:`thematicBreak`,position:void 0}}}function q(e){return{line:e.line,column:e.column,offset:e.offset}}function Kr(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?Kr(e,r):qr(e,r)}}function qr(e,t){let n;for(n in t)if(Ur.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`afterExit`:case`beforeEnter`:{let r=t[n];r&&e[n].push(r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function Jr(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Te({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Te({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Te({start:t.start,end:t.end})+`) is still open`)}function Yr(e){let t=this;t.parser=n;function n(n){return Wr(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Xr(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Zr(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e,A as t,D as n,H as r,J as i,K as a,M as o,N as s,O as c,Q as l,R as u,S as d,U as f,V as p,X as m,Z as h,_ as g,d as _,et as v,g as y,l as b,q as x,u as S,v as C,x as w,y as T,z as E}from"./index-
|
|
1
|
+
import{$ as e,A as t,D as n,H as r,J as i,K as a,M as o,N as s,O as c,Q as l,R as u,S as d,U as f,V as p,X as m,Z as h,_ as g,d as _,et as v,g as y,l as b,q as x,u as S,v as C,x as w,y as T,z as E}from"./index-DouLQdFE.js";import{n as D,r as O,t as k}from"./Markdown-TnAER8HW.js";import{i as ee,r as A}from"./WorkspaceTree-DN1U-aDQ.js";function j(e){return l(p,e)}var M=e(),N=i().regex(/^R\d{6,}$/),P=x({name:i().min(1),sha256:u,size:a().int().nonnegative()}),F=m().refine(e=>/^https?:\/\//i.test(e),`Use an HTTP or HTTPS URL.`);x({operationId:h(),title:i().trim().default(``),text:i().optional(),url:F.optional(),originals:f(P).default([])}).strict().refine(e=>!!e.text?.trim()||!!e.url||e.originals.length>0,`Provide text, a link or a file.`),x({expectedRevision:E,title:i().trim().min(1).optional(),content:i().optional(),summary:i().optional(),sourceVersion:i().optional(),contentDate:i().optional(),originals:f(P).optional()}).strict();var I=x({id:N,projectId:i(),title:i(),submittedBy:i(),createdAt:i(),revision:E,source:x({kind:r([`web`,`chat`,`group`]),url:i().nullable(),groupId:i().optional(),messageId:i().optional(),sourceVersion:i().optional(),contentDate:i().optional()}),originals:f(P),content:i().nullable(),summary:i().nullable(),state:r([`waiting`,`running`,`ready`,`failed`]),error:i().nullable(),url:i()}),L=x({materials:f(I),nextCursor:a().nullable()});x({query:i().trim().min(1),scope:r([`all`,`workspace`,`materials`]).default(`all`),materialId:N.optional(),originalHash:u.optional(),after:i().default(``),limit:j().int().min(1).max(200).default(30)}).strict();var R=x({items:f(x({key:i(),kind:r([`workspace`,`materials`]),title:i(),snippet:i(),url:i(),path:i()})),nextCursor:i().nullable()}),z=t();function te(e){let t=(e.content??``).trimStart().split(`
|
|
2
2
|
`);return t[0]?.replace(/^#\s+/,``).trim()===e.title.trim()&&t[0].startsWith(`# `)&&t.shift(),t.join(`
|
|
3
3
|
`).trimStart()}function B(){let e=new URLSearchParams(location.search),t=e.get(`id`);return t?{id:t,...e.get(`original`)?{original:e.get(`original`)}:{},...e.get(`revision`)?{revision:e.get(`revision`)}:{}}:void 0}function V(){let{request:e,projectId:t}=S(),[r,i]=(0,M.useState)(B),[a,s]=(0,M.useState)(r),[l,u]=(0,M.useState)(()=>new Set(r?[r.id]:[])),[f,p]=(0,M.useState)(!1),[m,h]=(0,M.useState)(``),[g,x]=(0,M.useState)(``),[w,E]=(0,M.useState)(``),[D,O]=(0,M.useState)([]),[j,N]=(0,M.useState)(),[P,F]=(0,M.useState)(!1),[R,V]=(0,M.useState)(``),U=(0,M.useRef)(null),W=(0,M.useCallback)(t=>e(`materials`,L,{signal:t}),[e]),G=n(W,5e3,c(t,`materials`)),ie=(0,M.useCallback)(t=>r?e(`materials/${encodeURIComponent(r.id)}${r.revision?`?revision=${encodeURIComponent(r.revision)}`:``}`,I,{signal:t}):Promise.resolve(null),[e,r?.id,r?.revision]),K=n(ie,5e3),q=K.data?.id===r?.id?K.data:null,J=[...new Map([...D,...G.data?.materials??[],...q?[q]:[]].map(e=>[e.id,e])).values()].sort((e,t)=>t.createdAt.localeCompare(e.createdAt)||t.id.localeCompare(e.id)),Y=j===void 0?G.data?.nextCursor:j;function X(e,n=``){i(e),s(e),x(``),E(n),p(!1),u(t=>new Set([...t,e.id])),history.replaceState(null,``,v(`/projects/${t}/materials?${new URLSearchParams({...e})}`))}(0,M.useEffect)(()=>{let e=()=>{let e=B();i(e),s(e),x(``),h(``),E(``),p(!1),e&&u(t=>new Set([...t,e.id]))};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]);async function ae(){if(Y&&!P){F(!0),V(``);try{let t=await e(`materials?before=${Y}`,L);O(e=>[...e,...t.materials]),N(t.nextCursor)}catch(e){V(o(e))}finally{F(!1)}}}let Z=J.find(e=>e.id===a?.id),Q=Z?.originals.find(e=>e.sha256===a?.original)?.name??Z?.title??`当前资料`;function $(){s(void 0),E(``),U.current?.focus()}return(0,z.jsxs)(`div`,{className:`split-layout file-explorer session-explorer`,"data-testid":`materials-page`,children:[(0,z.jsxs)(`aside`,{className:`file-tree-pane`,"aria-label":`资料目录`,children:[(0,z.jsx)(b,{title:`资料`,icon:`materials`,children:(0,z.jsx)(T,{icon:`plus`,label:`新增资料`,onClick:()=>{p(!0),V(``)}})}),(0,z.jsx)(d,{error:!0,children:G.error||R}),G.data?J.length===0?(0,z.jsx)(`p`,{className:`tree-status`,children:`暂无资料`}):(0,z.jsx)(`div`,{role:`tree`,"aria-label":`项目资料`,onKeyDown:A,children:J.map(e=>(0,z.jsxs)(`div`,{role:`none`,children:[(0,z.jsxs)(_,{role:`treeitem`,"aria-level":1,"aria-expanded":l.has(e.id),"aria-selected":!f&&r?.id===e.id&&!r.original,className:`tree-item tree-folder`,style:{"--tree-level":1},"data-testid":`material-folder`,title:e.title,onClick:()=>{let t=l.has(e.id);X({id:e.id}),t&&u(t=>{let n=new Set(t);return n.delete(e.id),n})},leading:(0,z.jsx)(`span`,{className:`tree-chevron ${l.has(e.id)?`expanded`:``}`,children:(0,z.jsx)(C,{name:`chevron`,size:`small`})}),children:[(0,z.jsx)(C,{name:`files`}),(0,z.jsx)(`span`,{className:`tree-name`,children:e.title})]}),l.has(e.id)&&(0,z.jsx)(`div`,{role:`group`,children:[...e.originals].sort((e,t)=>ee(e.name,t.name)).map((t,n)=>(0,z.jsxs)(_,{role:`treeitem`,"aria-level":2,"aria-selected":!f&&r?.id===e.id&&r.original===t.sha256,className:`tree-item`,style:{"--tree-level":2},"data-testid":`material-original`,title:t.name,onClick:()=>X({id:e.id,original:t.sha256,...e.id===r?.id&&r.revision?{revision:r.revision}:{}}),leading:(0,z.jsx)(`span`,{className:`tree-chevron`}),children:[(0,z.jsx)(C,{name:`file`}),(0,z.jsx)(`span`,{className:`tree-name`,children:t.name})]},`${t.sha256}:${n}`))})]},e.id))}):(0,z.jsx)(`p`,{className:`tree-status`,children:`加载中…`}),Y&&(0,z.jsx)(`button`,{className:`tree-action`,disabled:P,onClick:()=>void ae(),children:P?`加载中…`:`加载更多`})]}),(0,z.jsxs)(`section`,{className:`session-reader`,"aria-label":`资料内容与搜索`,children:[(0,z.jsx)(`div`,{className:`session-reader-content`,children:f?(0,z.jsx)(re,{onCancel:()=>p(!1),onSaved:e=>{X({id:e}),G.reload()}}):g?(0,z.jsx)(ne,{query:g,scope:a,onSelect:e=>X(e,g)},`${g}/${a?.id}/${a?.original}`):r?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(d,{error:!0,children:K.error}),q?r.original?(0,z.jsx)(H,{material:q,hash:r.original,highlight:w}):(0,z.jsxs)(`article`,{className:`material-body`,children:[(0,z.jsx)(`h1`,{children:q.title}),r.revision&&(0,z.jsx)(`button`,{className:`material-link`,onClick:()=>X({id:r.id}),children:`查看最新内容`}),!r.revision&&(q.state===`waiting`||q.state===`running`)?(0,z.jsx)(`p`,{className:`muted`,role:`status`,children:`正在整理…`}):null,(0,z.jsx)(d,{error:!0,children:q.error??``}),!r.revision&&q.state===`failed`&&(0,z.jsx)(`button`,{onClick:()=>void e(`materials/${r.id}/retry`,I,{method:`POST`}).then(()=>K.reload()).catch(e=>V(o(e))),children:`重试整理`}),q.content?(0,z.jsx)(`div`,{className:`markdown`,children:(0,z.jsx)(k,{highlight:w,children:te(q)})}):(0,z.jsx)(`p`,{className:`muted`,children:`正文尚未整理,可以先查看左侧原件。`})]}):(0,z.jsx)(`p`,{role:`status`,children:`加载中…`})]}):(0,z.jsx)(y,{mascot:!0,title:`选择资料开始阅读`,description:`也可以在下方搜索资料内容。`})}),!f&&(0,z.jsxs)(`form`,{className:`session-search-dock`,"data-testid":`material-search-form`,onSubmit:e=>{e.preventDefault(),x(m.trim()),E(``)},children:[a&&(0,z.jsxs)(`button`,{type:`button`,className:`search-scope-chip`,title:`清除搜索范围`,"aria-label":`清除范围:${Q}`,onClick:$,children:[(0,z.jsxs)(`span`,{className:`scope-label`,children:[`搜索:`,Q]}),(0,z.jsx)(`span`,{"aria-hidden":`true`,children:`×`})]}),(0,z.jsxs)(`div`,{className:`session-search-input-row`,children:[(0,z.jsx)(`input`,{ref:U,"aria-label":`搜索资料`,placeholder:`搜索资料内容`,value:m,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Backspace`&&!m&&a&&(e.preventDefault(),$())}}),(g||m||w)&&(0,z.jsx)(T,{icon:`close`,label:`清空搜索`,onClick:()=>{h(``),x(``),E(``),U.current?.focus()}}),(0,z.jsx)(T,{icon:`search`,type:`submit`,label:`搜索`,disabled:!m.trim()})]})]})]})]})}function ne({query:e,scope:t,onSelect:r}){let{request:i}=S(),[a,o]=(0,M.useState)(``),s=(0,M.useCallback)(n=>i(`resources/search?${new URLSearchParams({query:e,scope:`materials`,after:a,...t?{materialId:t.id}:{},...t?.original?{originalHash:t.original}:{}})}`,R,{signal:n}),[i,e,t?.id,t?.original,a]),c=n(s);return(0,z.jsxs)(`section`,{className:`session-results stack`,"aria-label":`搜索结果`,children:[(0,z.jsx)(d,{error:!0,children:c.error}),c.loading?(0,z.jsx)(`p`,{role:`status`,children:`正在搜索…`}):c.data?.items.length===0?(0,z.jsx)(`p`,{className:`empty`,children:`没有找到匹配的资料`}):c.data?.items.map(t=>(0,z.jsxs)(`button`,{className:`session-item`,"data-testid":`material-match`,onClick:()=>{let e=new URL(t.url,location.origin).searchParams;r({id:e.get(`id`),...e.get(`original`)?{original:e.get(`original`)}:{},...e.get(`revision`)?{revision:e.get(`revision`)}:{}})},children:[(0,z.jsx)(`strong`,{children:t.title.replace(/^R\d+ · /,``)}),(0,z.jsx)(`span`,{className:`session-excerpt`,children:(0,z.jsx)(D,{value:O(t.snippet,e),query:e})})]},t.key)),c.data?.nextCursor&&(0,z.jsx)(`button`,{disabled:c.loading,onClick:()=>o(c.data.nextCursor),children:`下一页`})]})}function H({material:e,hash:t,highlight:r}){let{projectId:i}=S(),a=e.originals.find(e=>e.sha256===t),o=v(`/api/v1/projects/${i}/materials/${e.id}/originals/${t}?revision=${e.revision}`),[s,l]=(0,M.useState)(!1),u=(0,M.useCallback)(async e=>{let t=await fetch(o,{signal:e});if(!t.ok)throw Error(`原件暂时无法读取。`);let n=await t.arrayBuffer();try{let e=new TextDecoder(`utf8`,{fatal:!0}).decode(n);return e.includes(`\0`)?null:e}catch{return null}},[o]),f=n(u,!1,c(i,`material-original`,t));if(!a)return(0,z.jsx)(d,{error:!0,children:`找不到此原件。`});let p=/\.(md|markdown)$/i.test(a.name);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`header`,{className:`file-detail-header`,children:[(0,z.jsx)(`span`,{className:`file-detail-path`,children:a.name}),(0,z.jsxs)(`div`,{className:`toolbar-actions`,children:[p&&(0,z.jsx)(T,{icon:s?`preview`:`code`,label:s?`切换为预览`:`切换为原文`,onClick:()=>l(!s)}),(0,z.jsx)(`a`,{className:`icon-button`,"aria-label":`下载原件`,title:`下载原件`,href:o,download:a.name,children:(0,z.jsx)(C,{name:`download`})})]})]}),(0,z.jsx)(d,{error:!0,children:f.error}),f.loading?(0,z.jsx)(`p`,{role:`status`,children:`加载中…`}):f.data===null?(0,z.jsx)(`p`,{className:`muted`,children:`此格式请下载后查看。`}):f.data!==void 0&&(0,z.jsx)(`div`,{className:`preview-body`,"data-testid":`material-original-content`,children:p&&!s?(0,z.jsx)(`article`,{className:`markdown`,children:(0,z.jsx)(k,{highlight:r,children:f.data})}):(0,z.jsx)(`pre`,{className:`raw`,children:(0,z.jsx)(D,{value:f.data,query:r})})})]})}function U(e){if(e.kind===`text`){try{if([`http:`,`https:`].includes(new URL(e.text.trim()).protocol))return`link`}catch{}return`text`}let{name:t,type:n}=e.file;return n.startsWith(`image/`)||/\.(png|jpe?g|gif|webp|svg|heic|avif)$/i.test(t)?`imageFile`:/\.(csv|tsv|xlsx?|ods)$/i.test(t)?`spreadsheetFile`:/\.(json|ya?ml|xml|html?|css|[cm]?[jt]sx?|py|go|rs|sh|sql)$/i.test(t)?`codeFile`:n.startsWith(`text/`)||/\.(pdf|docx?|odt|rtf|md|txt)$/i.test(t)?`file`:`attachment`}function W(e){try{return new URL(e.trim()).hostname}catch{return e.trim().split(`
|
|
4
4
|
`)[0]?.slice(0,80)||`文本`}}function G(e){try{return new URL(e.trim()).href}catch{return e.trim().split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,A as t,B as n,D as r,E as i,F as a,G as o,H as s,I as c,J as l,K as u,M as d,O as f,P as p,R as m,S as h,T as g,U as _,W as v,Y as y,Z as b,d as x,et as S,g as C,j as w,l as T,q as E,u as D,v as O,y as k,z as A}from"./index-DQsx-e5d.js";import{n as j,r as M,t as N}from"./Markdown-BRPMsc7D.js";import{n as P}from"./project-links-XbF78Bal.js";import{i as F,r as I}from"./WorkspaceTree-fMDtGIFa.js";var L=e(),R=s([`overview`,`handoff`]),z=E({title:l().trim().min(1),summary:l().trim().min(1)}).strict(),B=E({markdown:l().trim().min(1)}).strict(),V=z.extend({sourceRevision:A,sourceHash:m,generatedAt:l(),stale:v()}),H=E({kind:R,status:s([`absent`,`queued`,`running`,`succeeded`,`failed`]),available:v(),currentRevision:A,sourceRevision:A.nullable(),stale:v(),result:y([z,B]).nullable(),generatedAt:l().nullable(),error:l().nullable()}),U=s([`claude-code`,`codex`,`cursor`,`pi`,`dsh`]),W=E({formatVersion:o(1),adapterVersion:o(1),agent:U,nativeId:l().min(1).max(512),cwd:l().min(1).max(4096),messages:_(E({id:l().min(1).max(1024),role:s([`user`,`assistant`]),text:l().min(1),source:l().min(1).max(1024)}).strict())}).strict().refine(e=>new Set(e.messages.map(e=>e.id)).size===e.messages.length,`Duplicate message IDs.`);E({operationId:b(),sessionKey:m,parentRevision:A,blob:c}).strict(),E({revision:A,hash:m.nullable(),cleared:v()});var G=E({owner:n,sessionKey:m,agent:U,nativeId:l(),cwd:l(),title:l(),revision:A,updatedAt:l(),messageCount:u().int().nonnegative(),blob:c,overview:V.optional()}),K=E({sessions:_(G),nextCursor:A.nullable()}),q=E({totalSessions:u().int().nonnegative(),totalMessages:u().int().nonnegative(),memberCount:u().int().nonnegative(),updatedAt:l().nullable()});E({owner:n.optional(),sessionKey:m.optional()}).strict().refine(e=>!e.sessionKey||!!e.owner,`A session scope requires an owner.`);var J=E({matches:_(E({owner:n,sessionKey:m,revision:A,messageId:l(),role:s([`user`,`assistant`]),snippet:l(),title:l()})),nextCursor:A.nullable()}),Y=E({owner:n,key:m,revision:A.refine(e=>e>0).optional(),messageId:l().min(1).optional()});function X(e){let t=new URLSearchParams(e);if(![`owner`,`sessionKey`,`revision`,`messageId`].some(e=>t.has(e)))return{};let n=Y.safeParse({owner:t.get(`owner`),key:t.get(`sessionKey`),...t.has(`revision`)?{revision:Number(t.get(`revision`))}:{},...t.has(`messageId`)?{messageId:t.get(`messageId`)}:{}});return n.success?{target:n.data}:{error:`对话链接不完整或已损坏。`}}var Z=t();function Q({members:e,refresh:t,selected:n,onOwner:r,onSession:i}){let[a,o]=(0,L.useState)(()=>new Set(n?.key?[n.owner]:[])),[s,c]=(0,L.useState)(e[0]?.id??``);return(0,Z.jsx)(`div`,{role:`tree`,"aria-label":`成员对话`,"data-testid":`session-tree`,onKeyDown:I,children:[...e].sort((e,t)=>F(e.id,t.id)).map(e=>(0,Z.jsxs)(`div`,{role:`none`,children:[(0,Z.jsxs)(x,{type:`button`,role:`treeitem`,"aria-level":1,"aria-expanded":a.has(e.id),"aria-selected":n?.owner===e.id&&!n.key,className:`tree-item tree-folder`,style:{"--tree-level":1},tabIndex:s===e.id?0:-1,"data-testid":`session-owner`,"data-owner-id":e.id,onFocus:()=>c(e.id),onClick:()=>{o(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),r(e.id)},leading:(0,Z.jsx)(`span`,{className:`tree-chevron ${a.has(e.id)?`expanded`:``}`,children:(0,Z.jsx)(O,{name:`chevron`,size:`small`})}),children:[(0,Z.jsx)(O,{name:`files`}),(0,Z.jsx)(`span`,{className:`tree-name`,title:e.id,children:e.id})]}),a.has(e.id)&&(0,Z.jsx)($,{owner:e.id,selected:n,onSession:i,focused:s,onFocus:c},`${e.id}/${t}`)]},e.id))})}function $({owner:e,selected:t,onSession:n,focused:i,onFocus:a}){let{request:o,projectId:s}=D(),c=(0,L.useCallback)(t=>o(`sessions?${new URLSearchParams({owner:e,limit:`50`,order:`updated`})}`,K,{signal:t}),[e,o]),l=r(c,15e3,f(s,`session-tree`,e)),[u,m]=(0,L.useState)(),[g,_]=(0,L.useState)(!1),[v,y]=(0,L.useState)(``),b=(0,L.useRef)(null);(0,L.useEffect)(()=>()=>b.current?.abort(),[]);let S=u?u.nextCursor:l.data?.nextCursor;return(0,Z.jsxs)(`div`,{role:`group`,"aria-busy":l.loading||g,children:[(0,Z.jsx)(h,{error:!0,children:l.error||v}),l.error&&(0,Z.jsx)(`button`,{onClick:()=>void l.reload(),children:`重试`}),l.loading&&!l.data&&(0,Z.jsx)(`span`,{className:`tree-status`,role:`status`,children:`正在加载…`}),[...new Map([...u?.sessions??[],...l.data?.sessions??[]].map(e=>[e.sessionKey,e])).values()].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)||e.sessionKey.localeCompare(t.sessionKey)).map(r=>(0,Z.jsxs)(x,{type:`button`,role:`treeitem`,"aria-level":2,"aria-selected":t?.owner===e&&t.key===r.sessionKey,className:`tree-item`,style:{"--tree-level":2},tabIndex:i===`${e}/${r.sessionKey}`?0:-1,"data-testid":`session-row`,"data-owner-id":e,"data-session-key":r.sessionKey,title:p(r.title||r.nativeId),onFocus:()=>a(`${e}/${r.sessionKey}`),onClick:()=>n({owner:e,key:r.sessionKey,title:r.title||r.nativeId}),leading:(0,Z.jsx)(`span`,{className:`tree-chevron`}),children:[(0,Z.jsx)(O,{name:`sessions`}),(0,Z.jsx)(`span`,{className:`tree-name`,children:p(r.title||r.nativeId)})]},r.sessionKey)),S!=null&&(0,Z.jsx)(`button`,{className:`tree-action`,"data-testid":`session-tree-more`,disabled:g,onClick:async()=>{_(!0),y(``);let t=new AbortController;b.current=t;try{let n=await o(`sessions?${new URLSearchParams({owner:e,after:String(S),limit:`50`,order:`updated`})}`,K,{signal:t.signal});m(e=>({sessions:[...e?.sessions??[],...n.sessions],nextCursor:n.nextCursor}))}catch(e){t.signal.aborted||y(d(e))}finally{t.signal.aborted||_(!1)}},children:`加载更多`})]})}function ee({info:e}){let[t,n]=(0,L.useState)(!1);return(0,Z.jsxs)(`details`,{className:`session-handoff`,onToggle:e=>n(e.currentTarget.open),children:[(0,Z.jsx)(`summary`,{children:`交接说明`}),t&&(0,Z.jsx)(te,{info:e})]})}function te({info:e}){let{request:t}=D(),n=`sessions/${encodeURIComponent(e.owner)}/${e.sessionKey}`,a=(0,L.useCallback)(e=>t(`${n}/analysis/handoff`,H,{signal:e}),[t,n]),o=r(a,5e3),s=i(),[c,l]=(0,L.useState)(!1),[u,f]=(0,L.useState)(``),p=o.data,m=c||p?.status===`queued`||p?.status===`running`,_=p?.result&&`markdown`in p.result?p.result.markdown:void 0;return(0,Z.jsxs)(`div`,{className:`stack`,"data-testid":`session-handoff`,children:[(0,Z.jsx)(h,{error:!0,children:u||o.error}),p&&(0,Z.jsxs)(`div`,{className:`inline-actions`,children:[(!_||p.stale)&&(0,Z.jsx)(`button`,{"data-testid":`session-handoff-generate`,disabled:m||!p.available,onClick:async()=>{l(!0),f(``);try{await t(`${n}/handoff`,H,{method:`POST`,signal:s}),await o.reload()}catch(e){s.aborted||f(d(e))}finally{s.aborted||l(!1)}},children:m?`正在整理…`:p.status===`failed`?`重新生成`:_?`更新交接说明`:`生成交接说明`}),!p.available&&(0,Z.jsx)(`small`,{children:`请先配置项目模型接入点`}),p.status===`failed`&&(0,Z.jsx)(`small`,{children:`整理未完成,可重试`}),p.stale&&(0,Z.jsx)(`small`,{children:`对话已有新内容`}),p.currentRevision!==e.revision&&(0,Z.jsx)(`small`,{children:`交接说明使用最新对话;当前阅读的是历史原文`})]}),_&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`small`,{children:[`基于版本 `,p.sourceRevision,` · `,(0,Z.jsx)(g,{value:p.generatedAt})]}),(0,Z.jsx)(`div`,{className:`markdown`,"data-testid":`session-handoff-body`,children:(0,Z.jsx)(N,{children:_})})]})]})}function ne({members:e}){let{request:t,projectId:n,api:i}=D(),o=(0,L.useCallback)(async e=>{let[n,r]=await Promise.all([t(`sessions/stats`,q,{signal:e}),i.members(e)]);return{...n,members:r.members}},[t,i]),s=r(o,!0,f(n,`session-stats`)),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)(``),[m,g]=(0,L.useState)(0),[_]=(0,L.useState)(()=>X(location.search)),[v,y]=(0,L.useState)(_.target),[b,x]=(0,L.useState)(_.target),[w,E]=(0,L.useState)(_.error??``),[O,A]=(0,L.useState)(``),j=(0,L.useRef)(null),M=v?.key?v.title?`搜索对话:${p(v.title)}`:`搜索当前对话`:v?`搜索:${v.owner} 的对话内容`:``,N=()=>{y(void 0),A(``),F(),j.current?.focus()};function F(){if(!b?.messageId)return;let{messageId:e,...t}=b;x(t),history.replaceState(null,``,S(P(n,t.owner,t.key,t)))}let I=(0,L.useCallback)(e=>{y(t=>t?.owner===e.owner&&t.key===e.sessionKey&&t.title!==e.title?{...t,title:e.title}:t)},[]);(0,L.useEffect)(()=>{let e=()=>{let e=X(location.search);x(e.target),y(e.target),E(e.error??``),d(``),l(``),A(``)};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]);let R=(e,t=``)=>{x(e),y(e),d(``),A(t),E(``),history.replaceState(null,``,S(P(n,e.owner,e.key,e)))};return(0,Z.jsxs)(`div`,{className:`split-layout file-explorer session-explorer`,children:[(0,Z.jsxs)(`section`,{className:`file-tree-pane`,"aria-label":`${a.sessions}目录`,children:[(0,Z.jsx)(T,{title:a.sessions,icon:`sessions`,count:(0,Z.jsx)(`span`,{"data-testid":`session-total`,children:s.data?.totalSessions??`—`}),children:(0,Z.jsx)(k,{icon:`refresh`,label:`刷新${a.sessions}`,"data-testid":`sessions-refresh`,disabled:s.loading,onClick:()=>{s.reload(),g(e=>e+1)}})}),(0,Z.jsx)(h,{error:!0,children:s.error}),(0,Z.jsx)(Q,{members:(s.data?.members??e).filter(e=>e.hasSessions),refresh:m,selected:v,onOwner:e=>{y({owner:e}),x(void 0),d(``),A(``),E(``),history.replaceState(null,``,S(`/projects/${encodeURIComponent(n)}/sessions`))},onSession:R})]}),(0,Z.jsxs)(`section`,{className:`session-reader`,"aria-label":`对话内容与搜索`,children:[(0,Z.jsx)(`div`,{className:`session-reader-content`,children:w?(0,Z.jsx)(h,{error:!0,children:w}):u?(0,Z.jsx)(re,{query:u,refresh:m,scope:{...v?{owner:v.owner}:{},...v?.key?{sessionKey:v.key}:{}},onSelect:e=>R(e,u)},`${u}/${v?.owner??``}/${v?.key??``}`):b?(0,Z.jsx)(ie,{selection:b,highlight:O,onLoaded:I,onLatest:()=>R({owner:b.owner,key:b.key})},`${b.owner}/${b.key}/${b.revision}/${m}`):(0,Z.jsx)(C,{mascot:!0,title:`选择对话开始阅读`,description:`也可以在下方搜索会话库内容。`})}),(0,Z.jsxs)(`form`,{className:`session-search-dock`,"data-testid":`session-search-form`,onSubmit:e=>{e.preventDefault(),d(c.trim()),A(``),E(``),g(e=>e+1)},children:[v&&(0,Z.jsxs)(`button`,{type:`button`,className:`search-scope-chip`,"data-testid":`session-search-scope`,title:`清除搜索范围`,"aria-label":`清除范围:${M}`,onClick:N,children:[(0,Z.jsx)(`span`,{className:`scope-label`,children:M}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`×`})]}),(0,Z.jsxs)(`div`,{className:`session-search-input-row`,children:[(0,Z.jsx)(`input`,{ref:j,"aria-label":`搜索对话`,"data-testid":`session-query`,value:c,maxLength:500,placeholder:`搜索会话库内容`,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Backspace`&&!c&&v&&(e.preventDefault(),N())}}),(u||c||O)&&(0,Z.jsx)(k,{icon:`close`,label:`清空搜索`,"data-testid":`session-search-clear`,onClick:()=>{l(``),d(``),A(``),F(),j.current?.focus()}}),(0,Z.jsx)(k,{icon:`search`,type:`submit`,label:`搜索`,"data-testid":`session-search`,disabled:!c.trim()})]})]})]})]})}function re({query:e,refresh:t,scope:n,onSelect:i}){let{request:a}=D(),[o,s]=(0,L.useState)(0),c=(0,L.useCallback)(t=>a(`sessions/search?${new URLSearchParams({q:e,after:String(o),limit:`30`,order:`updated`,...n.owner?{owner:n.owner}:{},...n.sessionKey?{sessionKey:n.sessionKey}:{}})}`,J,{signal:t}),[a,e,o,t,n.owner,n.sessionKey]),l=r(c);return(0,Z.jsxs)(`section`,{className:`session-results stack`,"aria-label":`搜索结果`,"aria-busy":l.loading,children:[(0,Z.jsx)(h,{error:!0,children:l.error}),l.error&&(0,Z.jsx)(`button`,{onClick:()=>void l.reload(),children:`重试`}),l.loading&&(0,Z.jsx)(`p`,{role:`status`,children:`正在搜索…`}),!l.loading&&l.data?.matches.map(t=>(0,Z.jsxs)(`button`,{className:`session-item`,"data-testid":`session-match`,"data-message-id":t.messageId,onClick:()=>i({owner:t.owner,key:t.sessionKey,revision:t.revision,messageId:t.messageId,title:t.title}),children:[(0,Z.jsx)(`strong`,{children:p(t.title)}),(0,Z.jsxs)(`small`,{children:[t.owner,` · `,t.role===`user`?`用户`:`助手`]}),(0,Z.jsx)(`span`,{className:`session-excerpt`,children:(0,Z.jsx)(j,{value:M(t.snippet,e),query:e})})]},`${t.owner}:${t.sessionKey}:${t.revision}:${t.messageId}`)),!l.loading&&l.data?.matches.length===0&&(0,Z.jsx)(`p`,{className:`empty`,children:`没有找到匹配的对话`}),l.data?.nextCursor!=null&&(0,Z.jsx)(`button`,{"data-testid":`sessions-next`,disabled:l.loading,onClick:()=>s(l.data.nextCursor),children:`下一页`}),o>0&&(0,Z.jsx)(`button`,{disabled:l.loading,onClick:()=>s(0),children:`返回第一页`})]})}function ie({selection:e,highlight:t,onLoaded:n,onLatest:i}){let{request:a}=D(),o=(0,L.useCallback)(async t=>{try{return await a(`sessions/${encodeURIComponent(e.owner)}/${e.key}${e.revision===void 0?``:`?revision=${e.revision}`}`,G,{signal:t})}catch(e){throw e instanceof w&&e.code===`SESSION_NOT_FOUND`?Error(`找不到这条对话或引用的版本,原链接可能已失效。`):e}},[a,e.owner,e.key,e.revision]),s=r(o,5e3);return(0,L.useEffect)(()=>{s.data&&n(s.data)},[s.data,n]),(0,Z.jsxs)(`section`,{className:`session-conversation stack`,"data-testid":`session-detail`,children:[(0,Z.jsx)(h,{error:!0,children:s.error}),s.error&&(0,Z.jsx)(`button`,{onClick:()=>void s.reload(),children:`重试`}),s.loading&&!s.data&&(0,Z.jsx)(`p`,{role:`status`,children:`正在读取对话…`}),s.data&&(0,Z.jsx)(ae,{info:s.data,messageId:e.messageId,highlight:t,pinned:e.revision!==void 0,onLatest:i},s.data.blob.sha256)]})}function ae({info:e,messageId:t,highlight:n,pinned:i,onLatest:a}){let{readTextBlob:o,projectId:s}=D(),c=(0,L.useCallback)(async t=>W.parse(JSON.parse(await o(e.blob,t))),[e.blob.sha256,e.blob.size]),l=r(c),u=(0,L.useRef)(null);return(0,L.useEffect)(()=>{l.data&&t&&u.current?.scrollIntoView({block:`center`})},[l.data,t]),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`header`,{className:`conversation-header`,children:[(0,Z.jsx)(`h2`,{className:`session-title`,children:p(e.title||e.nativeId)}),(0,Z.jsxs)(`p`,{children:[e.owner,` · `,e.agent,` · `,e.messageCount,` 条消息`]}),(0,Z.jsxs)(`small`,{children:[(0,Z.jsx)(g,{value:e.updatedAt}),i&&(0,Z.jsxs)(Z.Fragment,{children:[` `,`· 引用版本 `,e.revision,` ·`,` `,(0,Z.jsx)(`a`,{href:S(P(s,e.owner,e.sessionKey)),onClick:e=>{e.preventDefault(),a()},children:`查看最新`})]})]}),e.overview&&(0,Z.jsx)(`p`,{"data-testid":`session-summary`,children:e.overview.summary}),e.overview?.stale&&(0,Z.jsx)(`small`,{children:`摘要待更新`})]}),(0,Z.jsx)(ee,{info:e}),(0,Z.jsx)(h,{error:!0,children:l.error}),l.error&&(0,Z.jsx)(`button`,{onClick:()=>void l.reload(),children:`重新读取`}),l.loading&&(0,Z.jsx)(`p`,{role:`status`,children:`正在读取对话…`}),l.data&&(0,Z.jsxs)(Z.Fragment,{children:[t&&!l.data.messages.some(e=>e.id===t)&&(0,Z.jsx)(h,{children:`该版本中找不到引用的消息,已打开对话原文。`}),(0,Z.jsx)(`div`,{className:`session-messages`,children:l.data.messages.map(e=>(0,Z.jsxs)(`article`,{className:`session-message ${e.role} ${e.id===t?`matched`:``}`,"data-testid":`session-message`,"data-message-id":e.id,ref:e.id===t?u:void 0,children:[(0,Z.jsx)(`div`,{className:`message-role`,children:e.role===`user`?`用户`:`助手`}),(0,Z.jsx)(`div`,{className:`markdown`,children:(0,Z.jsx)(N,{highlight:n,children:e.text})})]},e.id))})]})]})}export{ne as Sessions};
|
|
1
|
+
import{$ as e,A as t,B as n,D as r,E as i,F as a,G as o,H as s,I as c,J as l,K as u,M as d,O as f,P as p,R as m,S as h,T as g,U as _,W as v,Y as y,Z as b,d as x,et as S,g as C,j as w,l as T,q as E,u as D,v as O,y as k,z as A}from"./index-DouLQdFE.js";import{n as j,r as M,t as N}from"./Markdown-TnAER8HW.js";import{n as P}from"./project-links-XbF78Bal.js";import{i as F,r as I}from"./WorkspaceTree-DN1U-aDQ.js";var L=e(),R=s([`overview`,`handoff`]),z=E({title:l().trim().min(1),summary:l().trim().min(1)}).strict(),B=E({markdown:l().trim().min(1)}).strict(),V=z.extend({sourceRevision:A,sourceHash:m,generatedAt:l(),stale:v()}),H=E({kind:R,status:s([`absent`,`queued`,`running`,`succeeded`,`failed`]),available:v(),currentRevision:A,sourceRevision:A.nullable(),stale:v(),result:y([z,B]).nullable(),generatedAt:l().nullable(),error:l().nullable()}),U=s([`claude-code`,`codex`,`cursor`,`pi`,`dsh`]),W=E({formatVersion:o(1),adapterVersion:o(1),agent:U,nativeId:l().min(1).max(512),cwd:l().min(1).max(4096),messages:_(E({id:l().min(1).max(1024),role:s([`user`,`assistant`]),text:l().min(1),source:l().min(1).max(1024)}).strict())}).strict().refine(e=>new Set(e.messages.map(e=>e.id)).size===e.messages.length,`Duplicate message IDs.`);E({operationId:b(),sessionKey:m,parentRevision:A,blob:c}).strict(),E({revision:A,hash:m.nullable(),cleared:v()});var G=E({owner:n,sessionKey:m,agent:U,nativeId:l(),cwd:l(),title:l(),revision:A,updatedAt:l(),messageCount:u().int().nonnegative(),blob:c,overview:V.optional()}),K=E({sessions:_(G),nextCursor:A.nullable()}),q=E({totalSessions:u().int().nonnegative(),totalMessages:u().int().nonnegative(),memberCount:u().int().nonnegative(),updatedAt:l().nullable()});E({owner:n.optional(),sessionKey:m.optional()}).strict().refine(e=>!e.sessionKey||!!e.owner,`A session scope requires an owner.`);var J=E({matches:_(E({owner:n,sessionKey:m,revision:A,messageId:l(),role:s([`user`,`assistant`]),snippet:l(),title:l()})),nextCursor:A.nullable()}),Y=E({owner:n,key:m,revision:A.refine(e=>e>0).optional(),messageId:l().min(1).optional()});function X(e){let t=new URLSearchParams(e);if(![`owner`,`sessionKey`,`revision`,`messageId`].some(e=>t.has(e)))return{};let n=Y.safeParse({owner:t.get(`owner`),key:t.get(`sessionKey`),...t.has(`revision`)?{revision:Number(t.get(`revision`))}:{},...t.has(`messageId`)?{messageId:t.get(`messageId`)}:{}});return n.success?{target:n.data}:{error:`对话链接不完整或已损坏。`}}var Z=t();function Q({members:e,refresh:t,selected:n,onOwner:r,onSession:i}){let[a,o]=(0,L.useState)(()=>new Set(n?.key?[n.owner]:[])),[s,c]=(0,L.useState)(e[0]?.id??``);return(0,Z.jsx)(`div`,{role:`tree`,"aria-label":`成员对话`,"data-testid":`session-tree`,onKeyDown:I,children:[...e].sort((e,t)=>F(e.id,t.id)).map(e=>(0,Z.jsxs)(`div`,{role:`none`,children:[(0,Z.jsxs)(x,{type:`button`,role:`treeitem`,"aria-level":1,"aria-expanded":a.has(e.id),"aria-selected":n?.owner===e.id&&!n.key,className:`tree-item tree-folder`,style:{"--tree-level":1},tabIndex:s===e.id?0:-1,"data-testid":`session-owner`,"data-owner-id":e.id,onFocus:()=>c(e.id),onClick:()=>{o(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),r(e.id)},leading:(0,Z.jsx)(`span`,{className:`tree-chevron ${a.has(e.id)?`expanded`:``}`,children:(0,Z.jsx)(O,{name:`chevron`,size:`small`})}),children:[(0,Z.jsx)(O,{name:`files`}),(0,Z.jsx)(`span`,{className:`tree-name`,title:e.id,children:e.id})]}),a.has(e.id)&&(0,Z.jsx)($,{owner:e.id,selected:n,onSession:i,focused:s,onFocus:c},`${e.id}/${t}`)]},e.id))})}function $({owner:e,selected:t,onSession:n,focused:i,onFocus:a}){let{request:o,projectId:s}=D(),c=(0,L.useCallback)(t=>o(`sessions?${new URLSearchParams({owner:e,limit:`50`,order:`updated`})}`,K,{signal:t}),[e,o]),l=r(c,15e3,f(s,`session-tree`,e)),[u,m]=(0,L.useState)(),[g,_]=(0,L.useState)(!1),[v,y]=(0,L.useState)(``),b=(0,L.useRef)(null);(0,L.useEffect)(()=>()=>b.current?.abort(),[]);let S=u?u.nextCursor:l.data?.nextCursor;return(0,Z.jsxs)(`div`,{role:`group`,"aria-busy":l.loading||g,children:[(0,Z.jsx)(h,{error:!0,children:l.error||v}),l.error&&(0,Z.jsx)(`button`,{onClick:()=>void l.reload(),children:`重试`}),l.loading&&!l.data&&(0,Z.jsx)(`span`,{className:`tree-status`,role:`status`,children:`正在加载…`}),[...new Map([...u?.sessions??[],...l.data?.sessions??[]].map(e=>[e.sessionKey,e])).values()].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)||e.sessionKey.localeCompare(t.sessionKey)).map(r=>(0,Z.jsxs)(x,{type:`button`,role:`treeitem`,"aria-level":2,"aria-selected":t?.owner===e&&t.key===r.sessionKey,className:`tree-item`,style:{"--tree-level":2},tabIndex:i===`${e}/${r.sessionKey}`?0:-1,"data-testid":`session-row`,"data-owner-id":e,"data-session-key":r.sessionKey,title:p(r.title||r.nativeId),onFocus:()=>a(`${e}/${r.sessionKey}`),onClick:()=>n({owner:e,key:r.sessionKey,title:r.title||r.nativeId}),leading:(0,Z.jsx)(`span`,{className:`tree-chevron`}),children:[(0,Z.jsx)(O,{name:`sessions`}),(0,Z.jsx)(`span`,{className:`tree-name`,children:p(r.title||r.nativeId)})]},r.sessionKey)),S!=null&&(0,Z.jsx)(`button`,{className:`tree-action`,"data-testid":`session-tree-more`,disabled:g,onClick:async()=>{_(!0),y(``);let t=new AbortController;b.current=t;try{let n=await o(`sessions?${new URLSearchParams({owner:e,after:String(S),limit:`50`,order:`updated`})}`,K,{signal:t.signal});m(e=>({sessions:[...e?.sessions??[],...n.sessions],nextCursor:n.nextCursor}))}catch(e){t.signal.aborted||y(d(e))}finally{t.signal.aborted||_(!1)}},children:`加载更多`})]})}function ee({info:e}){let[t,n]=(0,L.useState)(!1);return(0,Z.jsxs)(`details`,{className:`session-handoff`,onToggle:e=>n(e.currentTarget.open),children:[(0,Z.jsx)(`summary`,{children:`交接说明`}),t&&(0,Z.jsx)(te,{info:e})]})}function te({info:e}){let{request:t}=D(),n=`sessions/${encodeURIComponent(e.owner)}/${e.sessionKey}`,a=(0,L.useCallback)(e=>t(`${n}/analysis/handoff`,H,{signal:e}),[t,n]),o=r(a,5e3),s=i(),[c,l]=(0,L.useState)(!1),[u,f]=(0,L.useState)(``),p=o.data,m=c||p?.status===`queued`||p?.status===`running`,_=p?.result&&`markdown`in p.result?p.result.markdown:void 0;return(0,Z.jsxs)(`div`,{className:`stack`,"data-testid":`session-handoff`,children:[(0,Z.jsx)(h,{error:!0,children:u||o.error}),p&&(0,Z.jsxs)(`div`,{className:`inline-actions`,children:[(!_||p.stale)&&(0,Z.jsx)(`button`,{"data-testid":`session-handoff-generate`,disabled:m||!p.available,onClick:async()=>{l(!0),f(``);try{await t(`${n}/handoff`,H,{method:`POST`,signal:s}),await o.reload()}catch(e){s.aborted||f(d(e))}finally{s.aborted||l(!1)}},children:m?`正在整理…`:p.status===`failed`?`重新生成`:_?`更新交接说明`:`生成交接说明`}),!p.available&&(0,Z.jsx)(`small`,{children:`请先配置项目模型接入点`}),p.status===`failed`&&(0,Z.jsx)(`small`,{children:`整理未完成,可重试`}),p.stale&&(0,Z.jsx)(`small`,{children:`对话已有新内容`}),p.currentRevision!==e.revision&&(0,Z.jsx)(`small`,{children:`交接说明使用最新对话;当前阅读的是历史原文`})]}),_&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`small`,{children:[`基于版本 `,p.sourceRevision,` · `,(0,Z.jsx)(g,{value:p.generatedAt})]}),(0,Z.jsx)(`div`,{className:`markdown`,"data-testid":`session-handoff-body`,children:(0,Z.jsx)(N,{children:_})})]})]})}function ne({members:e}){let{request:t,projectId:n,api:i}=D(),o=(0,L.useCallback)(async e=>{let[n,r]=await Promise.all([t(`sessions/stats`,q,{signal:e}),i.members(e)]);return{...n,members:r.members}},[t,i]),s=r(o,!0,f(n,`session-stats`)),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)(``),[m,g]=(0,L.useState)(0),[_]=(0,L.useState)(()=>X(location.search)),[v,y]=(0,L.useState)(_.target),[b,x]=(0,L.useState)(_.target),[w,E]=(0,L.useState)(_.error??``),[O,A]=(0,L.useState)(``),j=(0,L.useRef)(null),M=v?.key?v.title?`搜索对话:${p(v.title)}`:`搜索当前对话`:v?`搜索:${v.owner} 的对话内容`:``,N=()=>{y(void 0),A(``),F(),j.current?.focus()};function F(){if(!b?.messageId)return;let{messageId:e,...t}=b;x(t),history.replaceState(null,``,S(P(n,t.owner,t.key,t)))}let I=(0,L.useCallback)(e=>{y(t=>t?.owner===e.owner&&t.key===e.sessionKey&&t.title!==e.title?{...t,title:e.title}:t)},[]);(0,L.useEffect)(()=>{let e=()=>{let e=X(location.search);x(e.target),y(e.target),E(e.error??``),d(``),l(``),A(``)};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]);let R=(e,t=``)=>{x(e),y(e),d(``),A(t),E(``),history.replaceState(null,``,S(P(n,e.owner,e.key,e)))};return(0,Z.jsxs)(`div`,{className:`split-layout file-explorer session-explorer`,children:[(0,Z.jsxs)(`section`,{className:`file-tree-pane`,"aria-label":`${a.sessions}目录`,children:[(0,Z.jsx)(T,{title:a.sessions,icon:`sessions`,count:(0,Z.jsx)(`span`,{"data-testid":`session-total`,children:s.data?.totalSessions??`—`}),children:(0,Z.jsx)(k,{icon:`refresh`,label:`刷新${a.sessions}`,"data-testid":`sessions-refresh`,disabled:s.loading,onClick:()=>{s.reload(),g(e=>e+1)}})}),(0,Z.jsx)(h,{error:!0,children:s.error}),(0,Z.jsx)(Q,{members:(s.data?.members??e).filter(e=>e.hasSessions),refresh:m,selected:v,onOwner:e=>{y({owner:e}),x(void 0),d(``),A(``),E(``),history.replaceState(null,``,S(`/projects/${encodeURIComponent(n)}/sessions`))},onSession:R})]}),(0,Z.jsxs)(`section`,{className:`session-reader`,"aria-label":`对话内容与搜索`,children:[(0,Z.jsx)(`div`,{className:`session-reader-content`,children:w?(0,Z.jsx)(h,{error:!0,children:w}):u?(0,Z.jsx)(re,{query:u,refresh:m,scope:{...v?{owner:v.owner}:{},...v?.key?{sessionKey:v.key}:{}},onSelect:e=>R(e,u)},`${u}/${v?.owner??``}/${v?.key??``}`):b?(0,Z.jsx)(ie,{selection:b,highlight:O,onLoaded:I,onLatest:()=>R({owner:b.owner,key:b.key})},`${b.owner}/${b.key}/${b.revision}/${m}`):(0,Z.jsx)(C,{mascot:!0,title:`选择对话开始阅读`,description:`也可以在下方搜索会话库内容。`})}),(0,Z.jsxs)(`form`,{className:`session-search-dock`,"data-testid":`session-search-form`,onSubmit:e=>{e.preventDefault(),d(c.trim()),A(``),E(``),g(e=>e+1)},children:[v&&(0,Z.jsxs)(`button`,{type:`button`,className:`search-scope-chip`,"data-testid":`session-search-scope`,title:`清除搜索范围`,"aria-label":`清除范围:${M}`,onClick:N,children:[(0,Z.jsx)(`span`,{className:`scope-label`,children:M}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`×`})]}),(0,Z.jsxs)(`div`,{className:`session-search-input-row`,children:[(0,Z.jsx)(`input`,{ref:j,"aria-label":`搜索对话`,"data-testid":`session-query`,value:c,maxLength:500,placeholder:`搜索会话库内容`,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Backspace`&&!c&&v&&(e.preventDefault(),N())}}),(u||c||O)&&(0,Z.jsx)(k,{icon:`close`,label:`清空搜索`,"data-testid":`session-search-clear`,onClick:()=>{l(``),d(``),A(``),F(),j.current?.focus()}}),(0,Z.jsx)(k,{icon:`search`,type:`submit`,label:`搜索`,"data-testid":`session-search`,disabled:!c.trim()})]})]})]})]})}function re({query:e,refresh:t,scope:n,onSelect:i}){let{request:a}=D(),[o,s]=(0,L.useState)(0),c=(0,L.useCallback)(t=>a(`sessions/search?${new URLSearchParams({q:e,after:String(o),limit:`30`,order:`updated`,...n.owner?{owner:n.owner}:{},...n.sessionKey?{sessionKey:n.sessionKey}:{}})}`,J,{signal:t}),[a,e,o,t,n.owner,n.sessionKey]),l=r(c);return(0,Z.jsxs)(`section`,{className:`session-results stack`,"aria-label":`搜索结果`,"aria-busy":l.loading,children:[(0,Z.jsx)(h,{error:!0,children:l.error}),l.error&&(0,Z.jsx)(`button`,{onClick:()=>void l.reload(),children:`重试`}),l.loading&&(0,Z.jsx)(`p`,{role:`status`,children:`正在搜索…`}),!l.loading&&l.data?.matches.map(t=>(0,Z.jsxs)(`button`,{className:`session-item`,"data-testid":`session-match`,"data-message-id":t.messageId,onClick:()=>i({owner:t.owner,key:t.sessionKey,revision:t.revision,messageId:t.messageId,title:t.title}),children:[(0,Z.jsx)(`strong`,{children:p(t.title)}),(0,Z.jsxs)(`small`,{children:[t.owner,` · `,t.role===`user`?`用户`:`助手`]}),(0,Z.jsx)(`span`,{className:`session-excerpt`,children:(0,Z.jsx)(j,{value:M(t.snippet,e),query:e})})]},`${t.owner}:${t.sessionKey}:${t.revision}:${t.messageId}`)),!l.loading&&l.data?.matches.length===0&&(0,Z.jsx)(`p`,{className:`empty`,children:`没有找到匹配的对话`}),l.data?.nextCursor!=null&&(0,Z.jsx)(`button`,{"data-testid":`sessions-next`,disabled:l.loading,onClick:()=>s(l.data.nextCursor),children:`下一页`}),o>0&&(0,Z.jsx)(`button`,{disabled:l.loading,onClick:()=>s(0),children:`返回第一页`})]})}function ie({selection:e,highlight:t,onLoaded:n,onLatest:i}){let{request:a}=D(),o=(0,L.useCallback)(async t=>{try{return await a(`sessions/${encodeURIComponent(e.owner)}/${e.key}${e.revision===void 0?``:`?revision=${e.revision}`}`,G,{signal:t})}catch(e){throw e instanceof w&&e.code===`SESSION_NOT_FOUND`?Error(`找不到这条对话或引用的版本,原链接可能已失效。`):e}},[a,e.owner,e.key,e.revision]),s=r(o,5e3);return(0,L.useEffect)(()=>{s.data&&n(s.data)},[s.data,n]),(0,Z.jsxs)(`section`,{className:`session-conversation stack`,"data-testid":`session-detail`,children:[(0,Z.jsx)(h,{error:!0,children:s.error}),s.error&&(0,Z.jsx)(`button`,{onClick:()=>void s.reload(),children:`重试`}),s.loading&&!s.data&&(0,Z.jsx)(`p`,{role:`status`,children:`正在读取对话…`}),s.data&&(0,Z.jsx)(ae,{info:s.data,messageId:e.messageId,highlight:t,pinned:e.revision!==void 0,onLatest:i},s.data.blob.sha256)]})}function ae({info:e,messageId:t,highlight:n,pinned:i,onLatest:a}){let{readTextBlob:o,projectId:s}=D(),c=(0,L.useCallback)(async t=>W.parse(JSON.parse(await o(e.blob,t))),[e.blob.sha256,e.blob.size]),l=r(c),u=(0,L.useRef)(null);return(0,L.useEffect)(()=>{l.data&&t&&u.current?.scrollIntoView({block:`center`})},[l.data,t]),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`header`,{className:`conversation-header`,children:[(0,Z.jsx)(`h2`,{className:`session-title`,children:p(e.title||e.nativeId)}),(0,Z.jsxs)(`p`,{children:[e.owner,` · `,e.agent,` · `,e.messageCount,` 条消息`]}),(0,Z.jsxs)(`small`,{children:[(0,Z.jsx)(g,{value:e.updatedAt}),i&&(0,Z.jsxs)(Z.Fragment,{children:[` `,`· 引用版本 `,e.revision,` ·`,` `,(0,Z.jsx)(`a`,{href:S(P(s,e.owner,e.sessionKey)),onClick:e=>{e.preventDefault(),a()},children:`查看最新`})]})]}),e.overview&&(0,Z.jsx)(`p`,{"data-testid":`session-summary`,children:e.overview.summary}),e.overview?.stale&&(0,Z.jsx)(`small`,{children:`摘要待更新`})]}),(0,Z.jsx)(ee,{info:e}),(0,Z.jsx)(h,{error:!0,children:l.error}),l.error&&(0,Z.jsx)(`button`,{onClick:()=>void l.reload(),children:`重新读取`}),l.loading&&(0,Z.jsx)(`p`,{role:`status`,children:`正在读取对话…`}),l.data&&(0,Z.jsxs)(Z.Fragment,{children:[t&&!l.data.messages.some(e=>e.id===t)&&(0,Z.jsx)(h,{children:`该版本中找不到引用的消息,已打开对话原文。`}),(0,Z.jsx)(`div`,{className:`session-messages`,children:l.data.messages.map(e=>(0,Z.jsxs)(`article`,{className:`session-message ${e.role} ${e.id===t?`matched`:``}`,"data-testid":`session-message`,"data-message-id":e.id,ref:e.id===t?u:void 0,children:[(0,Z.jsx)(`div`,{className:`message-role`,children:e.role===`user`?`用户`:`助手`}),(0,Z.jsx)(`div`,{className:`markdown`,children:(0,Z.jsx)(N,{highlight:n,children:e.text})})]},e.id))})]})]})}export{ne as Sessions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,A as t,D as n,M as r,O as i,S as a,c as o,d as s,s as c,u as l,v as u}from"./index-
|
|
1
|
+
import{$ as e,A as t,D as n,M as r,O as i,S as a,c as o,d as s,s as c,u as l,v as u}from"./index-DouLQdFE.js";var d=e(),f=new Intl.Collator(`zh-CN`,{numeric:!0,sensitivity:`base`});function p(e,t){return f.compare(e,t)||(e<t?-1:+(e>t))}var m=t();function h(e){let t=e.target.closest(`[role="treeitem"]`);if(!t)return;let n=[...e.currentTarget.querySelectorAll(`[role="treeitem"]`)],r=n.indexOf(t),i=Number(t.getAttribute(`aria-level`)),a;switch(e.key){case`ArrowDown`:a=n[r+1];break;case`ArrowUp`:a=n[r-1];break;case`Home`:a=n[0];break;case`End`:a=n.at(-1);break;case`ArrowRight`:t.getAttribute(`aria-expanded`)===`false`?t.click():Number(n[r+1]?.getAttribute(`aria-level`))>i&&(a=n[r+1]);break;case`ArrowLeft`:t.getAttribute(`aria-expanded`)===`true`?t.click():a=n.slice(0,r).reverse().find(e=>Number(e.getAttribute(`aria-level`))<i);break;default:return}e.preventDefault(),a?.focus()}var g=(e,t)=>`${e}/${t}`,_=e=>({"--tree-level":e});function v({members:e,...t}){let[n,r]=(0,d.useState)(`folder:${g(e[0]?.id??``,``)}`);return(0,m.jsx)(`div`,{role:`tree`,"aria-label":`工作区文件`,"data-testid":`workspace-tree`,onKeyDown:h,children:(0,m.jsx)(b,{owner:c,path:``,level:1,members:e.filter(e=>e.hasFiles),context:{...t,focused:n,onFocus:r}})})}function y({owner:e,path:t,level:n,context:r}){let i=r.expanded.has(g(e,t)),a=`folder:${g(e,t)}`;return(0,m.jsxs)(`div`,{role:`none`,children:[(0,m.jsxs)(s,{type:`button`,role:`treeitem`,className:`tree-item tree-folder`,style:_(n),"aria-label":t||e,"aria-level":n,"aria-expanded":i,"aria-selected":r.selected?.kind===`directory`&&r.selected.owner===e&&r.selected.path===t,tabIndex:r.focused===a?0:-1,"data-testid":`directory-row`,"data-owner-id":e,"data-directory-path":t,onFocus:()=>r.onFocus(a),onClick:()=>r.onToggle(e,t),leading:(0,m.jsx)(`span`,{className:`tree-chevron ${i?`expanded`:``}`,children:(0,m.jsx)(u,{name:`chevron`,size:`small`})}),children:[(0,m.jsx)(u,{name:`files`}),(0,m.jsx)(`span`,{className:`tree-name`,children:t.split(`/`).at(-1)||e})]}),i&&(0,m.jsx)(b,{owner:e,path:t,level:n+1,context:r})]})}function b({owner:e,path:t,level:c,context:f,members:h=[]}){let{api:v,projectId:b}=l(),x=(0,d.useCallback)(n=>v.tree(e,t,void 0,``,n),[e,t]),S=n(x,!1,i(b,`file-tree`,e,t)),[C,w]=(0,d.useState)(),[T,E]=(0,d.useState)(!1),[D,O]=(0,d.useState)(``),k=(0,d.useRef)(null);(0,d.useEffect)(()=>()=>k.current?.abort(),[]);let A=C?.revision===S.data?.revision?C:void 0,j=A?A.nextCursor:S.data?.nextCursor;async function M(){if(!j||!S.data||T)return;E(!0),O(``);let n=new AbortController;k.current=n;try{let r=await v.tree(e,t,S.data.revision,j,n.signal);n.signal.aborted||w({...r,entries:[...A?.entries??[],...r.entries]})}catch(e){n.signal.aborted||O(r(e))}finally{n.signal.aborted||E(!1)}}let N=[...(S.data?.entries??[]).filter(e=>!o(e.path)),...(A?.entries??[]).filter(e=>!o(e.path))],P=f.revealed;if(P?.owner===e&&!o(P.path)&&(!t||P.path.startsWith(t+`/`))){let e=t?P.path.slice(t.length+1):P.path,n=e.indexOf(`/`),r=n<0?P.path:[t,e.slice(0,n)].filter(Boolean).join(`/`);N.some(e=>e.path===r)||N.push(n<0?{...P.file,kind:`file`}:{kind:`directory`,path:r})}let F=[...N.map(t=>({...t,owner:e})),...h.map(e=>({kind:`directory`,path:``,owner:e.id}))].sort((e,t)=>e.kind===t.kind?p(e.path.split(`/`).at(-1)||e.owner,t.path.split(`/`).at(-1)||t.owner):e.kind===`directory`?-1:1);return(0,m.jsxs)(`div`,{role:`group`,"aria-label":g(e===`_project`?`workspaces`:e,t),"aria-busy":S.loading||T,children:[S.loading&&(0,m.jsx)(`p`,{className:`tree-status`,role:`status`,children:`正在加载…`}),(0,m.jsx)(a,{error:!0,children:S.error||D}),S.error&&(0,m.jsx)(`button`,{className:`tree-action`,onClick:()=>void S.reload(),children:`重试`}),F.map(t=>t.kind===`directory`?(0,m.jsx)(y,{owner:t.owner,path:t.path,level:c,context:f},g(t.owner,t.path)):(0,m.jsxs)(s,{type:`button`,role:`treeitem`,className:`tree-item`,style:_(c),"aria-label":t.path,"aria-level":c,"aria-selected":f.selected?.kind===`file`&&f.selected.owner===e&&f.selected.path===t.path,tabIndex:f.focused===`file:${g(e,t.path)}`?0:-1,"data-testid":`file-row`,"data-owner-id":e,"data-file-path":t.path,onFocus:()=>f.onFocus(`file:${g(e,t.path)}`),onClick:()=>f.onSelect(e,t.path),leading:(0,m.jsx)(`span`,{className:`tree-chevron`}),children:[(0,m.jsx)(u,{name:`file`}),(0,m.jsx)(`span`,{className:`tree-name`,children:t.path.split(`/`).at(-1)})]},t.path)),j&&(0,m.jsx)(`button`,{className:`tree-action`,"data-testid":`files-load-more`,disabled:T,onClick:()=>void M(),children:T?`正在加载…`:`加载更多`})]})}export{p as i,g as n,h as r,v as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{L as e}from"./index-
|
|
1
|
+
import{L as e}from"./index-DouLQdFE.js";function t(t,n){if(!n||/^(?:[a-z][a-z0-9+.-]*:|\/)/i.test(n))return null;try{let r=n.split(/[?#]/,1)[0],i=r?t.split(`/`).slice(0,-1):t.split(`/`);for(let e of r.split(`/`)){let t=decodeURIComponent(e);if(t&&t!==`.`){if(t===`..`){if(!i.length)return null;i.pop()}else{if(t.includes(`/`)||t.includes(`\\`))return null;i.push(t)}}}return{path:i.length?e.parse(i.join(`/`)):``,directory:r.endsWith(`/`),anchor:n.includes(`#`)?decodeURIComponent(n.slice(n.indexOf(`#`)+1)):``}}catch{return null}}export{t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Materials-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Materials-CFm4FvpO.js","./Markdown-TnAER8HW.js","./WorkspaceTree-DN1U-aDQ.js","./Materials-CK-mbNmo.css","./Files-Ctal40MO.js","./project-links-XbF78Bal.js","./file-links-bWpY4fpg.js","./Assistant-DJV9aVRy.js","./Assistant-C7QfFYLo.css","./Dashboard-CDLBK91Q.js","./Dashboard-C6aBw_W-.css","./Sessions-CAEjqZpk.js","./Sessions-BwXwXx6i.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function u(){return document.querySelector(`meta[name="teammy-base-path"]`)?.content??``}function d(e){let t=u();return!e.startsWith(`/`)||e.startsWith(`//`)||!t||e===t||e.startsWith(t+`/`)||e.startsWith(t+`?`)?e:t+e}function f(){let e=u();return e&&(location.pathname===e||location.pathname.startsWith(e+`/`))?location.pathname.slice(e.length)||`/`:location.pathname}function p(){return location.origin+u()}var m=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function ee(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var te=ee.prototype=new b;te.constructor=ee,_(te,y.prototype),te.isPureReactComponent=!0;var ne=Array.isArray;function re(){}var x={H:null,A:null,T:null,S:null},ie=Object.prototype.hasOwnProperty;function S(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function ae(e,t){return S(e.type,t,e.props)}function oe(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function se(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ce=/\/+/g;function le(e,t){return typeof e==`object`&&e&&e.key!=null?se(``+e.key):t.toString(36)}function ue(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(re,re):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function de(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,de(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+le(e,0):a,ne(o)?(i=``,c!=null&&(i=c.replace(ce,`$&/`)+`/`),de(o,r,i,``,function(e){return e})):o!=null&&(oe(o)&&(o=ae(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ce,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(ne(e))for(var u=0;u<e.length;u++)a=e[u],s=l+le(a,u),c+=de(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+le(a,u++),c+=de(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return de(ue(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function fe(e,t,n){if(e==null)return e;var r=[],i=0;return de(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function pe(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var me=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function he(e){var t=x.T,n={};n.types=t===null?null:t.types,x.T=n;try{var r=e(),i=x.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(re,me)}catch(e){me(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),x.T=t}}function ge(e){var t=x.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else he(ge.bind(null,e))}var _e={map:fe,forEach:function(e,t,n){fe(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return fe(e,function(){t++}),t},toArray:function(e){return fe(e,function(e){return e})||[]},only:function(e){if(!oe(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=_e,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=ee,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=x,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return x.H.useMemoCache(e)}},e.addTransitionType=ge,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!ie.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return S(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)ie.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return S(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=oe,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:pe}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=he,e.unstable_useCacheRefresh=function(){return x.H.useCacheRefresh()},e.use=function(e){return x.H.use(e)},e.useActionState=function(e,t,n){return x.H.useActionState(e,t,n)},e.useCallback=function(e,t){return x.H.useCallback(e,t)},e.useContext=function(e){return x.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return x.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return x.H.useEffect(e,t)},e.useEffectEvent=function(e){return x.H.useEffectEvent(e)},e.useId=function(){return x.H.useId()},e.useImperativeHandle=function(e,t,n){return x.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return x.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return x.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return x.H.useMemo(e,t)},e.useOptimistic=function(e,t){return x.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return x.H.useReducer(e,t,n)},e.useRef=function(e){return x.H.useRef(e)},e.useState=function(e){return x.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return x.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return x.H.useTransition()},e.version=`19.3.1`})),h=o(((e,t)=>{t.exports=m()})),g=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function ee(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,te||(te=!0,ae());else{var t=n(l);t!==null&&ce(ee,t.startTime-e)}}}var te=!1,ne=-1,re=5,x=-1;function ie(){return g?!0:!(e.unstable_now()-x<re)}function S(){if(g=!1,te){var t=e.unstable_now();x=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(ne),ne=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ie());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ce(ee,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ae():te=!1}}}var ae;if(typeof y==`function`)ae=function(){y(S)};else if(typeof MessageChannel<`u`){var oe=new MessageChannel,se=oe.port2;oe.port1.onmessage=S,ae=function(){se.postMessage(null)}}else ae=function(){_(S,0)};function ce(t,n){ne=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):re=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(ne),ne=-1):h=!0,ce(ee,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,te||(te=!0,ae()))),r},e.unstable_shouldYield=ie,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),_=o(((e,t)=>{t.exports=g()})),v=o((e=>{var t=h();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=u(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=u(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.1`})),y=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=v()})),b=o((e=>{var t=_(),n=h(),r=y();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function f(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function p(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function m(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function g(e){var t=[null,null],n=p(e);return n===null||v(t,e,n.child,{foundSelf:!1}),t}function v(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&v(e,t,n.child,r))return!0;n=n.sibling}return!1}function b(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var ee=null,te=null;function ne(e,t,n){return e===n||e===t&&(ee=e,!0)}function re(e,t,n){return e===n?(te=e,!1):e===t&&(te!==null&&(ee=e),!0)}function x(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function ie(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var S=Object.assign,ae=Symbol.for(`react.element`),oe=Symbol.for(`react.transitional.element`),se=Symbol.for(`react.portal`),ce=Symbol.for(`react.fragment`),le=Symbol.for(`react.strict_mode`),ue=Symbol.for(`react.profiler`),de=Symbol.for(`react.consumer`),fe=Symbol.for(`react.context`),pe=Symbol.for(`react.forward_ref`),me=Symbol.for(`react.suspense`),he=Symbol.for(`react.suspense_list`),ge=Symbol.for(`react.memo`),_e=Symbol.for(`react.lazy`),ve=Symbol.for(`react.activity`),ye=Symbol.for(`react.legacy_hidden`),be=Symbol.for(`react.memo_cache_sentinel`),xe=Symbol.for(`react.view_transition`),Se=Symbol.for(`react.recoverable`),Ce=Symbol.iterator;function we(e){return typeof e!=`object`||!e?null:(e=Ce&&e[Ce]||e[`@@iterator`],typeof e==`function`?e:null)}var C=Symbol.for(`react.client.reference`);function Te(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===C?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case ce:return`Fragment`;case ue:return`Profiler`;case le:return`StrictMode`;case me:return`Suspense`;case he:return`SuspenseList`;case ve:return`Activity`;case xe:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case se:return`Portal`;case fe:return e.displayName||`Context`;case de:return(e._context.displayName||`Context`)+`.Consumer`;case pe:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ge:return t=e.displayName||null,t===null?Te(e.type)||`Memo`:t;case _e:t=e._payload,e=e._init;try{return Te(e(t))}catch{}}return null}var Ee=Array.isArray,w=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,T=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,De={pending:!1,data:null,method:null,action:null},Oe=[],ke=-1;function Ae(e){return{current:e}}function je(e){0>ke||(e.current=Oe[ke],Oe[ke]=null,ke--)}function Me(e,t){ke++,Oe[ke]=e.current,e.current=t}var Ne=Ae(null),Pe=Ae(null),Fe=Ae(null),Ie=Ae(null);function Le(e,t){switch(Me(Fe,t),Me(Pe,e),Me(Ne,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}je(Ne),Me(Ne,e)}function Re(){je(Ne),je(Pe),je(Fe)}function ze(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,Me(Ie,e)),t=Ne.current;var n=dp(t,e.type);t!==n&&(Me(Pe,e),Me(Ne,n))}function Be(e){Pe.current===e&&(je(Ne),je(Pe)),Ie.current===e&&(je(Ie),sh._currentValue=De)}var Ve,He;function Ue(e){if(Ve===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ve=t&&t[1]||``,He=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+Ve+e+He}var We=!1;function Ge(e,t){if(!e||We)return``;We=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -63,4 +63,4 @@ Error generating stack: `+e.message+`
|
|
|
63
63
|
|
|
64
64
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Xa(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Xa(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Za=new Set([`type`,`properties`,`required`,`additionalProperties`]),Qa=[`oneOf`,`anyOf`];function $a(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function eo(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Za.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??$a(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}se(n,r,e.length===1?e[0]:eo(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=$a(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function to(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Za)if(t in e)return;let n=t.filter(e=>Qa.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=eo(t);else{let e=n[0],i=Qa.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>eo([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Wa(e,r))}function no(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Wa(i,s),Wa(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Xa(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])to(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Wa(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,se(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ao(t,`input`,e.processors),output:ao(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function ro(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return ro(r.element,n);if(r.type===`set`)return ro(r.valueType,n);if(r.type===`lazy`)return ro(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return ro(r.innerType,n);if(r.type===`intersection`)return ro(r.left,n)||ro(r.right,n);if(r.type===`record`||r.type===`map`)return ro(r.keyType,n)||ro(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:ro(r.in,n)||ro(r.out,n);if(r.type===`object`){for(let e in r.shape)if(ro(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(ro(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(ro(e,n))return!0;return!!(r.rest&&ro(r.rest,n))}return!1}var io=(e,t={})=>n=>{let r=Ga({...n,processors:t});return qa(e,r),Ya(r,e),no(r,e)},ao=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ga({...i??{},target:a,io:t,processors:n});return qa(e,o),Ya(o,e),no(o,e)},oo=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},so=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},co=(e,t)=>{oo(e,`minimum`,t),so(e,`maximum`,t)},lo=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},uo=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},fo=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},po=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},mo=(e,t)=>oo(e,`minimum`,t.minimum),ho=(e,t)=>so(e,`maximum`,t.maximum),go=e=>(t,n)=>{po(t,n.format);let[r,i]=e[n.format];oo(t,`minimum`,r),so(t,`maximum`,i)},_o={greater_than:(e,t)=>oo(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>so(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>lo(e,t.value),number_format:go(w),bigint_format:go(T),min_length:mo,max_length:ho,length_equals:(e,t)=>co(e,t.length),min_size:mo,max_size:ho,size_equals:(e,t)=>co(e,t.size),string_format:(e,t)=>{po(e,t.format),t.pattern&&uo(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>fo(e,t.mime)};function vo(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)_o[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&oo(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&oo(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&so(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&so(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&lo(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&fo(t,i.mime);for(let e of i.patterns??[])uo(t,e);return t}var yo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},bo=new Map([[Sr,an],[wr,on]]),xo=e=>bo.get(e)??e,So=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=vo(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=yo[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(xo);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Co=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=vo(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Ka(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},wo=(e,t,n,r)=>{n.type=`boolean`},To=(e,t,n,r)=>{n.not={}},Eo=(e,t,n,r)=>{let i=e._zod.def,a=te(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},Do=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Ka(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Ka(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Oo=(e,t,n,r)=>{Ka(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},ko=(e,t,n,r)=>{Ka(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Ao=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=vo(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=qa(a.element,t,{...r,path:[...r.path,`items`]})};function jo(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?jo(t.out):t.type===`catch`?jo(t.innerType):e._zod.optin}var Mo=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Ka(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)se(i.properties,e,qa(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?jo(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=qa(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},No=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>qa(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Po=(e,t,n,r)=>{let i=e._zod.def,a=qa(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=qa(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Fo=(e,t,n,r)=>{let i=e._zod.def,a=qa(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Io=(e,t,n,r)=>{let i=e._zod.def;qa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Lo=Symbol();function Ro(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Ka(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Lo):JSON.parse(o)}var zo=(e,t,n,r)=>{let i=e._zod.def;qa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Ro(i.defaultValue,e,t,n,r);o!==Lo&&(n.default=o)},Bo=(e,t,n,r)=>{let i=e._zod.def;qa(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Ro(i.defaultValue,e,t,n,r);o!==Lo&&(n._prefault=o)},Vo=(e,t,n,r)=>{let i=e._zod.def;qa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Ka(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Ho=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;qa(o,t,r);let s=t.seen.get(e);s.ref=o},Uo=(e,t,n,r)=>{let i=e._zod.def;qa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Wo=(e,t,n,r)=>{let i=e._zod.def;qa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Go=new WeakSet([Object.prototype,Error.prototype]);function Ko(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var qo=(e,t)=>{yt.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Go.has(n)||(Go.add(n),Ko(n,`format`,e=>t=>St(e,t)),Ko(n,`flatten`,e=>t=>xt(e,t)),Ko(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,re,2)}),Ko(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,re,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},Jo=D(`ZodError`,qo),Yo=D(`ZodError`,qo,void 0,{Parent:Error}),Xo=wt(Yo),Zo=Tt(Yo),Qo=Et(Yo),$o=Ot(Yo),A=Pt(Yo),es=Ft(Yo),ts=It(Yo),ns=Lt(Yo),rs=Rt(Yo),is=zt(Yo),as=Bt(Yo),os=Vt(Yo);function ss(){ft.localeError||pt(Ii())}function cs(){ft.memoizer||pt({memoizer:Ni()})}var j=D(`ZodType`,(e,t)=>(ss(),Bn.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(me(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return we(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Cc(e,t))},superRefine(e,t){return this.check(wc(e,t))},overwrite(e){return this.check(Pa(e))},optional(){return ac(this)},exactOptional(){return sc(this)},nullable(){return lc(this)},nullish(){return ac(lc(this))},nonoptional(e){return hc(this,e)},array(){return F(this)},or(e){return Js([this,e])},and(e){return Qs(this,e)},transform(e){return yc(this,rc(e))},default(e){return dc(this,e)},prefault(e){return pc(this,e)},catch(e){return _c(this,e)},pipe(e){return yc(this,e)},readonly(){return xc(this)},describe(e){let t=this.clone();return Bi.add(t,{description:e}),t},meta(...e){if(e.length===0)return Bi.get(this);let t=this.clone();return Bi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Xe(this,`~standard`,{...Un(this),jsonSchema:{input:ao(this,`input`),output:ao(this,`output`)}})},set"~standard"(e){Ye(this,`~standard`,e)},parse:function e(t,n){return Xo(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Zo(this,t,n,{callee:e})},safeParse(e,t){return Qo(this,e,t)},async safeParseAsync(e,t){return $o(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Ye(this,`spa`,e)},validate(e,t){return jt(this,e,t)},validateAsync(e,t){return Nt(this,e,t)},encode:function e(t,n){return A(this,t,n,{callee:e})},decode:function e(t,n){return es(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await ts(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await ns(this,t,n,{callee:e})},safeEncode(e,t){return rs(this,e,t)},safeDecode(e,t){return is(this,e,t)},async safeEncodeAsync(e,t){return as(this,e,t)},async safeDecodeAsync(e,t){return os(this,e,t)},toJSONSchema(e){return io(this,{})(e)},get description(){return Bi.get(this)?.description},get _def(){return this._zod.def}}),ls=D(`_ZodString`,(e,t)=>{Wn.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r)},Ze({format:e=>vo(e).format??null,minLength:e=>vo(e).minimum??null,maxLength:e=>vo(e).maximum??null},{regex(...e){return this.check(Oa(...e))},includes(...e){return this.check(ja(...e))},startsWith(...e){return this.check(Ma(...e))},endsWith(...e){return this.check(Na(...e))},min(...e){return this.check(Ea(...e))},max(...e){return this.check(Ta(...e))},length(...e){return this.check(Da(...e))},nonempty(...e){return this.check(Ea(1,...e))},lowercase(e){return this.check(ka(e))},uppercase(e){return this.check(Aa(e))},trim(){return this.check(Ia())},normalize(...e){return this.check(Fa(...e))},toLowerCase(){return this.check(La())},toUpperCase(){return this.check(Ra())},slugify(){return this.check(za())}})),us=D(`ZodString`,(e,t)=>{Wn.init(e,t),ls.init(e,t)},{email(e){return this.check(Ui(gs,e))},url(e){return this.check(Yi(bs,e))},jwt(e){return this.check(ua(Is,e))},emoji(e){return this.check(Xi(Ss,e))},guid(e){return this.check(Wi(_s,e))},uuid(e){return this.check(Gi(vs,e))},uuidv4(e){return this.check(Ki(vs,e))},uuidv6(e){return this.check(qi(vs,e))},uuidv7(e){return this.check(Ji(vs,e))},nanoid(e){return this.check(Zi(Cs,e))},cuid(e){return this.check(Qi(ws,e))},cuid2(e){return this.check($i(Ts,e))},ulid(e){return this.check(ea(Es,e))},base64(e){return this.check(sa(Ns,e))},base64url(e){return this.check(ca(Ps,e))},xid(e){return this.check(ta(Ds,e))},ksuid(e){return this.check(na(Os,e))},ipv4(e){return this.check(ra(ks,e))},ipv6(e){return this.check(ia(As,e))},cidrv4(e){return this.check(aa(js,e))},cidrv6(e){return this.check(oa(Ms,e))},e164(e){return this.check(la(Fs,e))},datetime(e){return this.check(da(fs,e))},date(e){return this.check(fa(ps,e))},time(e){return this.check(pa(ms,e))},duration(e){return this.check(ma(hs,e))}});function M(e){return Hi(us,e)}var ds=D(`ZodStringFormat`,(e,t)=>{Gn.init(e,t),ls.init(e,t)}),fs=D(`ZodISODateTime`,(e,t)=>{ur.init(e,t),ds.init(e,t)}),ps=D(`ZodISODate`,(e,t)=>{dr.init(e,t),ds.init(e,t)}),ms=D(`ZodISOTime`,(e,t)=>{fr.init(e,t),ds.init(e,t)}),hs=D(`ZodISODuration`,(e,t)=>{pr.init(e,t),ds.init(e,t)}),gs=D(`ZodEmail`,(e,t)=>{Jn.init(e,t),ds.init(e,t)}),_s=D(`ZodGUID`,(e,t)=>{Kn.init(e,t),ds.init(e,t)}),vs=D(`ZodUUID`,(e,t)=>{qn.init(e,t),ds.init(e,t)});function ys(e){return Gi(vs,e)}var bs=D(`ZodURL`,(e,t)=>{nr.init(e,t),ds.init(e,t)});function xs(e){return Yi(bs,e)}var Ss=D(`ZodEmoji`,(e,t)=>{rr.init(e,t),ds.init(e,t)}),Cs=D(`ZodNanoID`,(e,t)=>{ir.init(e,t),ds.init(e,t)}),ws=D(`ZodCUID`,(e,t)=>{ar.init(e,t),ds.init(e,t)}),Ts=D(`ZodCUID2`,(e,t)=>{or.init(e,t),ds.init(e,t)}),Es=D(`ZodULID`,(e,t)=>{sr.init(e,t),ds.init(e,t)}),Ds=D(`ZodXID`,(e,t)=>{cr.init(e,t),ds.init(e,t)}),Os=D(`ZodKSUID`,(e,t)=>{lr.init(e,t),ds.init(e,t)}),ks=D(`ZodIPv4`,(e,t)=>{mr.init(e,t),ds.init(e,t)}),As=D(`ZodIPv6`,(e,t)=>{_r.init(e,t),ds.init(e,t)}),js=D(`ZodCIDRv4`,(e,t)=>{vr.init(e,t),ds.init(e,t)}),Ms=D(`ZodCIDRv6`,(e,t)=>{br.init(e,t),ds.init(e,t)}),Ns=D(`ZodBase64`,(e,t)=>{Cr.init(e,t),ds.init(e,t)}),Ps=D(`ZodBase64URL`,(e,t)=>{Er.init(e,t),ds.init(e,t)}),Fs=D(`ZodE164`,(e,t)=>{Dr.init(e,t),ds.init(e,t)}),Is=D(`ZodJWT`,(e,t)=>{kr.init(e,t),ds.init(e,t)}),Ls=D(`ZodNumber`,(e,t)=>{Ar.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r),e.isFinite=!0},Ze({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=vo(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=vo(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=vo(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>vo(e).format??null},{gt(e,t){return this.check(Sa(e,t))},gte(e,t){return this.check(Ca(e,t))},min(e,t){return this.check(Ca(e,t))},lt(e,t){return this.check(ba(e,t))},lte(e,t){return this.check(xa(e,t))},max(e,t){return this.check(xa(e,t))},int(e){return this.check(zs(e))},safe(e){return this.check(zs(e))},positive(e){return this.check(Sa(0,e))},nonnegative(e){return this.check(Ca(0,e))},negative(e){return this.check(ba(0,e))},nonpositive(e){return this.check(xa(0,e))},multipleOf(e,t){return this.check(wa(e,t))},step(e,t){return this.check(wa(e,t))},finite(){return this}}));function N(e){return ha(Ls,e)}var Rs=D(`ZodNumberFormat`,(e,t)=>{jr.init(e,t),Ls.init(e,t)});function zs(e){return ga(Rs,e)}var Bs=D(`ZodBoolean`,(e,t)=>{Mr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r)});function P(e){return _a(Bs,e)}var Vs=D(`ZodUnknown`,(e,t)=>{Nr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Hs(){return va(Vs)}var Us=D(`ZodNever`,(e,t)=>{Pr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r)});function Ws(e){return ya(Us,e)}var Gs=D(`ZodArray`,(e,t)=>{cs(),Rr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Ea(e,t))},nonempty(e){return this.check(Ea(1,e))},max(e,t){return this.check(Ta(e,t))},length(e,t){return this.check(Da(e,t))},unwrap(){return this.element}});function F(e,t){return Ba(Gs,e,t)}var Ks=D(`ZodObject`,(e,t)=>{cs(),Wr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),rt(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return L(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(me(this._zod.def,{catchall:e}))},passthrough(){return this.clone(me(this._zod.def,{catchall:Hs()}))},loose(){return this.clone(me(this._zod.def,{catchall:Hs()}))},strict(){return this.clone(me(this._zod.def,{catchall:Ws()}))},strip(){return this.clone(me(this._zod.def,{catchall:void 0}))},extend(e){return Ae(this,e)},safeExtend(e){return Me(this,e)},merge(e){return Ne(this,e)},pick(e){return De(this,e)},omit(e){return ke(this,e)},partial(...e){return Pe(ic,this,e[0])},exactPartial(...e){return Pe(oc,this,e[0],`exactPartial`)},required(...e){return Fe(mc,this,e[0])}});function I(e,t){return new Ks({type:`object`,shape:e??{},...C(t)})}var qs=D(`ZodUnion`,(e,t)=>{Kr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r),e.options=t.options});function Js(e,t){return new qs({type:`union`,options:e,...C(t)})}var Ys=D(`ZodDiscriminatedUnion`,(e,t)=>{qs.init(e,t),Jr.init(e,t)});function Xs(e,t,n){return new Ys({type:`union`,options:t,discriminator:e,...C(n)})}var Zs=D(`ZodIntersection`,(e,t)=>{Yr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r)});function Qs(e,t){return new Zs({type:`intersection`,left:e,right:t})}var $s=D(`ZodEnum`,(e,t)=>{Qr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new $s({...t,checks:[],...C(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new $s({...t,checks:[],...C(r),entries:i})}});function L(e,t){return new $s({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...C(t)})}var ec=D(`ZodLiteral`,(e,t)=>{$r.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function tc(e,t){return new ec({type:`literal`,values:Array.isArray(e)?e:[e],...C(t)})}var nc=D(`ZodTransform`,(e,t)=>{cs(),ei.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new dt(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(qe(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(qe(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function rc(e){return new nc({type:`transform`,transform:e})}var ic=D(`ZodOptional`,(e,t)=>{ni.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ac(e){return new ic({type:`optional`,innerType:e})}var oc=D(`ZodExactOptional`,(e,t)=>{ri.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sc(e){return new oc({type:`optional`,innerType:e})}var cc=D(`ZodNullable`,(e,t)=>{ii.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function lc(e){return new cc({type:`nullable`,innerType:e})}var uc=D(`ZodDefault`,(e,t)=>{ai.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function dc(e,t){return new uc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():xe(t)}})}var fc=D(`ZodPrefault`,(e,t)=>{si.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pc(e,t){return new fc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():xe(t)}})}var mc=D(`ZodNonOptional`,(e,t)=>{ci.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hc(e,t){return new mc({type:`nonoptional`,innerType:e,...C(t)})}var gc=D(`ZodCatch`,(e,t)=>{di.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function _c(e,t){return new gc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:at(t)})}var vc=D(`ZodPipe`,(e,t)=>{fi.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r),e.in=t.in,e.out=t.out});function yc(e,t){return new vc({type:`pipe`,in:e,out:t})}var bc=D(`ZodReadonly`,(e,t)=>{mi.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xc(e){return new bc({type:`readonly`,innerType:e})}var Sc=D(`ZodCustom`,(e,t)=>{gi.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r)});function Cc(e,t={}){return Va(Sc,e,t)}function wc(e,t){return Ha(e,t)}var R=h(),Tc=ee(),z=M().regex(/^[a-z][a-z0-9_-]{0,63}$/),Ec=ys();I({deviceId:Ec,projectId:z.optional()}).strict(),I({workspaceId:z,memberId:z,deviceId:Ec}),I({members:F(z)});var Dc=134217728,Oc=10485760,kc=3e5,Ac=M().regex(/^[a-f0-9]{64}$/),jc=N().int().nonnegative().max(2**53-1),Mc=M().min(1).max(1024).refine(e=>e!==e.normalize(`NFC`)||/[\\\x00-\x1f\x7f:<>"|?*]/.test(e)?!1:e.split(`/`).every(e=>e.length>0&&e.length<=255&&e!==`.`&&e!==`..`&&!/[. ]$/.test(e)&&!/^\.teammy(?:-|$)/i.test(e)&&!/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(e)),`Path must be a portable, normalized relative file path.`),Nc=I({sha256:Ac,size:N().int().min(0).max(Dc)}),Pc=Nc.extend({size:N().int().min(0).max(Oc)}),Fc=Xs(`kind`,[Pc.extend({kind:tc(`upsert`),path:Mc}).strict(),I({kind:tc(`delete`),path:Mc}).strict()]);I({operationId:ys(),parentRevision:jc,changes:F(Fc)}).strict().refine(e=>new Set(e.changes.map(e=>e.path)).size===e.changes.length,`Duplicate paths in a publication.`),I({operationId:ys(),revision:jc});var Ic=Pc.extend({path:Mc,revision:jc});I({revision:jc,complete:P().default(!1),files:F(Ic),nextCursor:M().nullable()}),I({headRevision:jc,revisions:F(I({revision:jc,operationId:ys(),createdAt:M(),changes:F(Fc)}))}),I({hashes:F(Ac).max(200)}).strict(),I({missing:F(Ac)});var Lc=Xs(`kind`,[Ic.extend({kind:tc(`file`)}),I({kind:tc(`directory`),path:Mc,fileCount:N().int().positive()})]),Rc=I({revision:jc,path:Js([tc(``),Mc]),entries:F(Lc),nextCursor:M().nullable()}),zc=I({revision:jc,file:Ic}),Bc=M().url().max(2048).refine(e=>{let t=new URL(e);return[`http:`,`https:`].includes(t.protocol)&&!t.username&&!t.password&&!t.search&&!t.hash},`Use an HTTP(S) server URL without credentials, query or fragment.`),Vc=I({checkIntervalSeconds:N().int().min(1).max(86400),fileSettleSeconds:N().int().min(0).max(86400)}).strict(),Hc=I({schemaVersion:tc(1),projectId:z,projectName:M().trim().min(1).max(120),description:M().max(2e3),publicServerUrl:Bc,configRevision:jc,scopeProfile:tc(`workspace-and-sessions-v1`),sync:Vc}).strict(),Uc=I({operationId:ys(),publicServerUrl:Bc,adminId:z}).strict(),Wc=I({initialized:P()}),Gc=Hc.pick({projectName:!0,description:!0}).extend({expectedRevision:jc.optional()}).strict(),Kc=I({id:z,displayName:M().max(120),enabled:P(),accountEnabled:P(),revision:jc,bound:P(),fileRevision:jc,lastPublishedAt:M().nullable(),hasFiles:P().default(!1),hasSessions:P().default(!1)}),qc=I({memberId:z,displayName:M(),siteRole:L([`admin`,`member`])}),Jc=qc.extend({workspaceId:z}),Yc=I({id:z}).strict(),Xc=I({expectedRevision:jc,displayName:M().trim().max(120).optional(),enabled:P().optional()}).strict();I({operationId:ys(),projectName:M().trim().min(1).max(120),description:M().max(2e3).default(``),workspacePath:M().trim().min(1).optional()}).strict();var Zc=I({projects:F(I({projectId:z,projectName:M(),description:M()}))}),Qc=I({sync:Vc,publicServerUrl:Bc,revision:jc}),$c=I({publicServerUrl:Bc.optional(),sync:Vc.optional(),expectedRevision:jc}).strict().refine(e=>e.publicServerUrl!==void 0||e.sync!==void 0,`Provide a setting to update.`),el=I({id:z,displayName:M(),siteRole:L([`admin`,`member`]),enabled:P(),revision:jc}),tl=I({id:z,displayName:M().trim().max(120).default(``),siteRole:L([`admin`,`member`]).default(`member`)}).strict(),nl=I({expectedRevision:jc,displayName:M().trim().max(120).optional(),enabled:P().optional(),siteRole:L([`admin`,`member`]).optional()}).strict(),B={brand:`Teammy`,navigation:`主导航`,filePreview:`文件预览`,versionPicker:`选择目录版本`,connectCommand:`连接命令`,syncCommand:`开启同步命令`,syncStopCommand:`停止同步命令`,installCommandLabel:`安装命令`,skipToMain:`跳到主要内容`,loading:`正在加载…`,retry:`重试`,refresh:`刷新`,cancel:`取消`,close:`关闭`,save:`保存`,saving:`正在保存…`,next:`下一步`,back:`上一步`,confirm:`确认`,logout:`退出登录`,menu:`导航菜单`,files:`工作区`,dashboard:`工作看板`,sessions:`对话库`,members:`成员`,settings:`设置`,account:`个人账户`,project:`项目`,projectName:`项目名称`,description:`项目说明`,address:`团队接入地址`,addressHint:`填写成员设备能够访问的服务地址。`,adminId:`管理员 ID`,memberId:`成员 ID`,idHint:`以小写字母开头,最多 64 位,可包含数字、短横线或下划线。ID 创建后不可修改。`,displayName:`显示名称`,admin:`管理员`,member:`成员`,enabled:`已启用`,disabled:`已停用`,login:`进入工作台`,loginTitle:`连接你的团队`,loginHint:`输入管理员预先建立的成员 ID。`,existing:`接入已有工作区`,choose:`请选择`,interval:`文件检查间隔(秒)`,settle:`文件稳定等待(秒)`,timingHint:`文件停止修改后开始计时。新设置约 30 秒后下发,当前批次结束后生效。`,scope:`共享范围`,owner:`文件所属成员`,noFiles:`该目录版本暂无文件`,noFilesHint:`运行客户端同步后查看。`,pickFile:`选择文件,查看内容`,more:`加载更多`,name:`文件路径`,size:`大小`,version:`版本`,directoryVersion:`目录版本`,latest:`最新版本`,viewVersion:`查看版本`,download:`下载原文件`,raw:`原文`,rendered:`预览`,previewUnavailable:`该文件不支持文本预览,请下载查看。`,previewLarge:`文件超过 512 KiB,请下载查看完整内容。`,readOnly:`只读`,refreshFiles:`刷新目录`,remoteImage:`图片`,addMember:`添加成员`,editName:`修改名称`,disableMember:`停用成员`,enableMember:`启用成员`,resetDevice:`重置设备`,resetHint:`撤销该成员的设备凭证,保留共享文件与历史。成员需要重新运行 connect --reconnect。`,disableHint:`停止该成员访问和同步本项目,保留历史资料。其他项目不受影响。`,enableHint:`恢复本项目访问权限。设备需要重新接入。`,bound:`设备已绑定`,unbound:`尚未绑定设备`,noContact:`尚无状态报告`,lastContact:`最近联系`,lastPublished:`最近发布`,noPublication:`尚未发布文件`,stale:`报告已超过 2 分钟`,applied:`已应用`,waiting:`等待应用`,failed:`应用失败`,received:`已接收`,saved:`服务端已保存`,override:`含命令行覆盖`,effective:`当前有效策略`,syncResult:`最近同步`,pending:`待发文件`,clientVersion:`客户端版本`,syncIssues:`同步提示`,statusHint:`最近上报状态,非实时在线状态。`,connectTitle:`连接项目目录`,connectHint:`在工作目录(例如 utu/)运行以下命令,并在打开的网页中确认用户 ID,将当前工作目录连接到 Teammy 服务:`,connectAfter:`注意:会话采集以工作目录为范围,只采集该目录及其子目录中的 Agent 会话。因此,建议在项目根目录(例如 utu/)执行此命令。`,install:`首次使用`,installHint:`需要 Node.js 22.19+。安装后按上方说明连接项目。`,copy:`复制`,copied:`已复制`,copyFailed:`复制失败,请手动选择命令。`,configSaved:`设置已保存,等待客户端接收并上报。`,reloadConfig:`读取最新设置`,configConflict:`设置已被其他成员修改。先读取最新设置,再重新编辑。`,permissionHint:`公共设置由管理员维护。`,application:`配置应用情况`,serverVersion:`服务端版本`,notReported:`未上报`,seconds:`秒`,errors:{AI_DEFAULT_REQUIRED:`请选择模型,或先设置默认接入点。`,AI_PROFILE_DISABLED:`该模型接入点已停用,请重新选择。`,AI_CONFIG_CONFLICT:`模型设置已更新,请重新载入后保存。`,SITE_ADMIN_REQUIRED:`此操作需要站点管理员身份。`,USER_NOT_FOUND:`用户尚未建立或账号已停用,请联系站点管理员。`,USER_EXISTS:`该用户 ID 已存在。`,PROJECT_NOT_FOUND:`项目不存在或你已不再是该项目成员。`,PROJECT_REQUIRED:`请选择一个项目。`,PROJECT_MISMATCH:`设备凭证属于其他项目。`,UNKNOWN_MEMBER:`成员 ID 不存在或已被停用。`,LOGIN_REQUIRED:`登录已失效,请重新登录。`,ADMIN_REQUIRED:`此操作需要管理员身份。`,STALE_CONFIG:`设置已变更,请读取最新设置后重试。`,STALE_MEMBER:`成员信息已变更,请刷新后重试。`,LAST_ADMIN:`至少需要保留一位启用的管理员。`,MEMBER_EXISTS:`该成员 ID 已存在。`,ALREADY_INITIALIZED:`服务已初始化,请刷新页面进入登录。`,INVALID_REQUEST:`请检查输入内容和数值范围。`,INVALID_RESPONSE:`服务返回了无法识别的响应,请刷新后重试。`,GATEWAY_ERROR:`服务网关未能转发请求,请检查部署配置。`,FORBIDDEN:`没有执行此操作的权限。`,INVALID_REVISION:`该目录版本不存在。`}};function rl(e){let t=e.replace(/\s+/g,` `).trim()||`未命名对话`,n=Array.from(t);return n.length>56?n.slice(0,56).join(``)+`…`:t}var il=class extends Error{code;status;constructor(e,t,n){super(B.errors[e]??t),this.code=e,this.status=n}},al;async function V(e,t,n={}){let r=n.method??`GET`,i=await fetch(d(`/api/v1/${e}`),{method:r===`PATCH`?`POST`:r,headers:{accept:`application/json`,...r===`PATCH`?{"x-http-method-override":`PATCH`}:{},...n.body===void 0?{}:{"content-type":`application/json`},...r===`GET`?{}:{"x-teammy-web":`1`}},body:n.body===void 0?void 0:JSON.stringify(n.body),signal:n.signal?AbortSignal.any([n.signal,AbortSignal.timeout(n.timeoutMs??15e3)]):AbortSignal.timeout(n.timeoutMs??15e3),credentials:`same-origin`}),a=i.headers.get(`x-teammy-data-generation`);if(a){let e=al!==void 0&&al!==a;al=a,e&&window.dispatchEvent(new Event(`teammy:data-reset`))}let o=await i.json().catch(()=>{throw new il(`INVALID_RESPONSE`,``,i.status)});if(o?.Response?.Error)throw new il(`GATEWAY_ERROR`,``,i.status);if(!i.ok){let e=new il(o?.error?.code??`HTTP_ERROR`,o?.error?.message??`HTTP ${i.status}`,i.status);throw e.code===`LOGIN_REQUIRED`&&window.dispatchEvent(new Event(`teammy:logout`)),e}let s=t.safeParse(o);if(!s.success)throw new il(`INVALID_RESPONSE`,``,i.status);return s.data}var ol={server:e=>V(`server`,I({version:M()}),{signal:e}),projects:e=>V(`projects`,Zc,{signal:e}),setup:e=>V(`setup`,Wc,{signal:e}),session:e=>V(`web/session`,qc,{signal:e}),login:e=>V(`web/session`,qc,{method:`POST`,body:{id:e}}),logout:()=>V(`web/session`,I({ok:P()}),{method:`DELETE`})};function sl(e){return{config:t=>e(`project/config`,Hc,{signal:t}),members:t=>e(`web/members`,I({members:F(Kc)}),{signal:t}),file:(t,n,r,i)=>e(`files/${encodeURIComponent(t)}/entry?${new URLSearchParams({path:n,...r===void 0?{}:{revision:String(r)}})}`,zc,{signal:i}),tree:(t,n,r,i,a)=>e(`files/${encodeURIComponent(t)}/tree?${new URLSearchParams({path:n,after:i,limit:`100`,...r===void 0?{}:{revision:String(r)}})}`,Rc,{signal:a})}}function H(e){return e instanceof Jo?B.errors.INVALID_REQUEST:e instanceof Error?e.message:String(e)}function cl(e){return`'${e.replaceAll(`'`,`'\\''`)}'`}function ll(){let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}async function ul(e,t,n){let r=await fetch(d(`${n}/blobs/${e.sha256}`),{signal:AbortSignal.any([t,AbortSignal.timeout(kc)])});if(!r.ok)throw r.status===401&&window.dispatchEvent(new Event(`teammy:logout`)),new il(`HTTP_ERROR`,`HTTP ${r.status}`,r.status);let i=await r.arrayBuffer();if(i.byteLength!==e.size)throw Error(`File size mismatch.`);let a;try{a=new TextDecoder(`utf-8`,{fatal:!0}).decode(i)}catch{throw Error(B.previewUnavailable)}if(a.includes(`\0`))throw Error(B.previewUnavailable);return a}var dl=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),fl=o(((e,t)=>{t.exports=dl()})),U=fl(),pl=class{values=new Map;get(e){return this.values.get(e)}set(e,t){this.values.set(e,t)}delete(e){this.values.delete(e)}},ml=(0,R.createContext)(void 0);function hl({children:e}){let[{cache:t,generation:n},r]=(0,R.useState)(()=>({cache:new pl,generation:0}));return(0,R.useEffect)(()=>{let e=()=>{let e=new URL(location.href);for(let t of[`chat`,`message`])e.searchParams.delete(t);history.replaceState(history.state,``,e),r(e=>({cache:new pl,generation:e.generation+1}))};return window.addEventListener(`teammy:data-reset`,e),()=>window.removeEventListener(`teammy:data-reset`,e)},[]),(0,U.jsx)(ml.Provider,{value:t,children:(0,U.jsx)(R.Fragment,{children:e},n)})}var gl=()=>(0,R.useContext)(ml),_l=(...e)=>JSON.stringify(e);function W(e,t=!1,n){let r=gl(),i=n??e,a=()=>n?r?.get(n):void 0,[o,s]=(0,R.useState)(()=>({source:i,data:a(),error:``,loading:!0})),c=o.source===i?o:{source:i,data:a(),error:``,loading:!0},l=(0,R.useRef)(null),u=(0,R.useRef)(0),d=(0,R.useCallback)(async()=>{l.current?.abort();let t=new AbortController;l.current=t;let o=++u.current;s(e=>({source:i,data:e.source===i?e.data:a(),error:``,loading:!0}));try{let a=await e(t.signal);o===u.current&&(n&&r?.set(n,a),s({source:i,data:a,error:``,loading:!1}))}catch(e){if(!t.signal.aborted&&o===u.current){let t=e instanceof il&&[401,403,404].includes(e.status);t&&n&&r?.delete(n),s(n=>({...n,data:t?void 0:n.data,error:H(e)}))}}finally{o===u.current&&(s(e=>({...e,loading:!1})),l.current=null)}},[e,n,r]);return(0,R.useEffect)(()=>{d();let e=()=>{!document.hidden&&!l.current&&d()},n=t?setInterval(e,typeof t==`number`?t:3e4):void 0;return t&&document.addEventListener(`visibilitychange`,e),()=>{u.current++,l.current?.abort(),l.current=null,clearInterval(n),document.removeEventListener(`visibilitychange`,e)}},[d,t]),{data:c.data,error:c.error,loading:c.loading,reload:d}}function vl(){let[e]=(0,R.useState)(()=>new AbortController);return(0,R.useEffect)(()=>()=>e.abort(),[e]),e.signal}async function yl(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}let t=document.activeElement,n=window.getSelection(),r=n?Array.from({length:n.rangeCount},(e,t)=>n.getRangeAt(t).cloneRange()):[],i=document.createElement(`textarea`);i.value=e,i.readOnly=!0,i.style.cssText=`position:fixed;left:0;top:0;opacity:0;pointer-events:none;`,document.body.append(i);try{if(i.focus({preventScroll:!0}),i.select(),!document.execCommand(`copy`))throw Error(`Clipboard copy was denied.`)}finally{if(i.remove(),t instanceof HTMLElement&&t.focus({preventScroll:!0}),n){n.removeAllRanges();for(let e of r)n.addRange(e)}}}var bl=new URL(`teammy-wordmark-ZFwxG0yl.png`,import.meta.url).href,xl=new URL(`teammy-mark-CxBtF1-X.png`,import.meta.url).href,Sl=new URL(`teammy-calm-DVuoOK0F.png`,import.meta.url).href,Cl=new URL(`teammy-wave-CVTgecuC.png`,import.meta.url).href,wl=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function Tl(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:wl(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var El=e=>{let t=``,n=!1;for(let r of e)r===`-`||r===`_`||r<=` `?n=t.length>0:(t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1);return t},Dl=e=>{let t=El(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ol=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),kl={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function Al(e){return e!=null}function jl(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??kl.width,a=e.size??e.height??kl.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?Ol(...c):Ol(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??kl[`stroke-width`])*Number(e.size??e.width??kl.width)/Number(t.size??t.width??kl.width):t.strokeWidth??kl[`stroke-width`];return[`svg`,{...Object.entries(kl).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&Al(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&Al(t.width)&&{[r(`width`)]:t.width},...`height`in t&&Al(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function Ml(e,t={}){return jl(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var Nl=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Pl=(0,R.createContext)({}),Fl=()=>(0,R.useContext)(Pl),Il=(0,R.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=Fl()??{},y=!!c||Nl(d),[b,ee,te=[]]=Ml(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:Ol(v,s),hasA11yProp:y,attributes:d});return(0,R.createElement)(b,{ref:f,...ee},[...te.map(([e,t])=>(0,R.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function G(e,t=[],n=[]){let r=typeof e==`string`?Tl(e,t,n):e,i=(0,R.forwardRef)(({className:e,...t},n)=>(0,R.createElement)(Il,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=Dl(r.name)),i}var Ll={name:`archive`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]};Ll.node;var Rl=G(Ll),zl={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};zl.node;var Bl=G(zl),Vl={name:`bell`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]};Vl.node;var Hl=G(Vl),Ul={name:`book-open`,size:24,node:[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]};Ul.node;var Wl=G(Ul),Gl={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};Gl.node;var Kl=G(Gl),ql={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};ql.node;var Jl=G(ql),Yl={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Yl.node;var Xl=G(Yl),Zl={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};Zl.node;var Ql=G(Zl),$l={name:`circle-alert`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]],aliases:[`alert-circle`]};$l.node;var eu=G($l),tu={name:`code-xml`,size:24,node:[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]],aliases:[`code-2`]};tu.node;var nu=G(tu),ru={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};ru.node;var K=G(ru),iu={name:`cpu`,size:24,node:[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]};iu.node;var au=G(iu),ou={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]};ou.node;var su=G(ou),cu={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};cu.node;var lu=G(cu),uu={name:`file-code`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]};uu.node;var du=G(uu),fu={name:`file-image`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]};fu.node;var pu=G(fu),mu={name:`file-plus-corner`,size:24,node:[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]],aliases:[`file-plus-2`]};mu.node;var hu=G(mu),gu={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};gu.node;var _u=G(gu),vu={name:`file-text`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]};vu.node;var yu=G(vu),bu={name:`folder-open`,size:24,node:[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]};bu.node;var xu=G(bu),Su={name:`folder`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};Su.node;var Cu=G(Su),wu={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};wu.node;var Tu=G(wu),Eu={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};Eu.node;var Du=G(Eu),Ou={name:`link-2`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]};Ou.node;var ku=G(Ou),Au={name:`list-plus`,size:24,node:[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]};Au.node;var ju=G(Au),Mu={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};Mu.node;var Nu=G(Mu),Pu={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};Pu.node;var Fu=G(Pu),Iu={name:`message-circle`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]};Iu.node;var Lu=G(Iu),Ru={name:`messages-square`,size:24,node:[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]};Ru.node;var zu=G(Ru),Bu={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};Bu.node;var Vu=G(Bu),Hu={name:`paperclip`,size:24,node:[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]};Hu.node;var Uu=G(Hu),Wu={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};Wu.node;var Gu=G(Wu),Ku={name:`plug`,size:24,node:[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]};Ku.node;var qu=G(Ku),Ju={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Ju.node;var Yu=G(Ju),Xu={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};Xu.node;var Zu=G(Xu),Qu={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Qu.node;var q=G(Qu),$u={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};$u.node;var J=G($u),Y={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};Y.node;var ed=G(Y),td={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};td.node;var nd=G(td),rd={name:`text-align-start`,size:24,node:[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]],aliases:[`text`,`align-left`]};rd.node;var id=G(rd),ad={name:`user-round-check`,size:24,node:[[`path`,{d:`M2 21a8 8 0 0 1 13.292-6`,key:`bjp14o`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`path`,{d:`m16 19 2 2 4-4`,key:`1b14m6`}]],aliases:[`user-check-2`]};ad.node;var od=G(ad),sd={name:`user-round`,size:24,node:[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]],aliases:[`user-2`]};sd.node;var cd=G(sd),ld={name:`user-round-x`,size:24,node:[[`path`,{d:`m16.5 16.5 5 5`,key:`zc9lw7`}],[`path`,{d:`M2 21a8 8 0 0 1 11.531-7.18`,key:`x5izle`}],[`path`,{d:`m21.5 16.5-5 5`,key:`1empo3`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}]],aliases:[`user-x-2`]};ld.node;var ud=G(ld),dd={name:`users`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]};dd.node;var fd=G(dd),pd={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};pd.node;var md=G(pd);function hd({compact:e=!1}){return(0,U.jsx)(`div`,{className:`brand ${e?`brand-compact`:``}`,children:(0,U.jsx)(`img`,{src:e?xl:bl,alt:`Teammy`})})}function gd({pose:e=`calm`}){return(0,U.jsx)(`img`,{className:`mascot mascot-${e}`,src:e===`wave`?Cl:Sl,alt:``,"aria-hidden":`true`})}function _d({name:e,small:t=!1}){return(0,U.jsx)(`span`,{className:`avatar ${t?`small`:``}`,"aria-hidden":`true`,children:Array.from(e)[0]?.toUpperCase()})}function vd({children:e}){return(0,U.jsx)(`span`,{className:`count`,children:e})}function yd({title:e,description:t,icon:n,mascot:r=!1,children:i}){return(0,U.jsxs)(`div`,{className:`empty-state`,children:[r?(0,U.jsx)(gd,{}):n?(0,U.jsx)(Od,{name:n}):null,(0,U.jsx)(`h3`,{children:e}),t&&(0,U.jsx)(`p`,{children:t}),i]})}function bd({title:e,count:t,children:n}){return(0,U.jsxs)(`div`,{className:`section-heading`,children:[(0,U.jsxs)(`h2`,{children:[e,t!==void 0&&(0,U.jsx)(vd,{children:t})]}),n]})}function xd({label:e,children:t}){return(0,U.jsx)(`div`,{className:`toolbar-actions`,role:`group`,"aria-label":e,children:t})}function X({children:e,error:t=!1}){return e?(0,U.jsx)(`div`,{"data-testid":`notice`,"data-kind":t?`error`:`info`,className:`notice ${t?`error`:``}`,role:t?`alert`:`status`,children:e}):null}function Z({id:e,name:t,label:n,hint:r,children:i}){let a=[i.props[`aria-describedby`],r?`${e}-hint`:void 0].filter(Boolean).join(` `)||void 0;return(0,U.jsxs)(`label`,{className:`field`,htmlFor:e,children:[(0,U.jsx)(`span`,{id:`${e}-label`,children:n}),(0,R.cloneElement)(i,{id:e,name:t??i.props.name??e,"data-testid":e,"aria-labelledby":`${e}-label`,"aria-describedby":a}),r&&(0,U.jsx)(`small`,{id:`${e}-hint`,children:r})]})}function Sd({title:e,description:t,children:n}){return(0,U.jsxs)(`header`,{className:`page-header`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h1`,{children:e}),t&&(0,U.jsx)(`p`,{children:t})]}),n]})}function Cd({id:e,title:t,children:n,onClose:r}){let i=(0,R.useRef)(null);return(0,R.useEffect)(()=>{let e=document.activeElement;return i.current?.showModal(),()=>{i.current?.close(),e?.focus()}},[]),(0,U.jsx)(`dialog`,{id:e,"data-testid":e,"aria-labelledby":`${e}-title`,ref:i,onCancel:r,onClick:e=>{e.target===e.currentTarget&&r()},children:(0,U.jsxs)(`div`,{className:`dialog-content`,children:[(0,U.jsxs)(`header`,{className:`dialog-header`,children:[(0,U.jsx)(`h2`,{id:`${e}-title`,children:t}),(0,U.jsx)(kd,{icon:`close`,label:B.close,"data-testid":`dialog-close`,onClick:r})]}),n]})})}function wd({id:e,label:t,value:n}){let[r,i]=(0,R.useState)(``);return(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`command`,"data-testid":e,children:[(0,U.jsx)(`code`,{"data-testid":`${e}-value`,children:n}),(0,U.jsx)(kd,{icon:`copy`,"data-testid":`${e}-copy`,label:`${B.copy}${t}`,onClick:async()=>{try{await yl(n),i(B.copied)}catch{i(B.copyFailed)}}})]}),r&&(0,U.jsx)(`small`,{"data-testid":`${e}-feedback`,role:`status`,children:r})]})}function Td({value:e}){return e?(0,U.jsx)(`time`,{dateTime:e,children:new Date(e).toLocaleString(`zh-CN`,{hour12:!1})}):(0,U.jsx)(`span`,{children:`—`})}var Ed={assistant:nd,archive:Rl,send:Bl,dashboard:Du,sessions:zu,message:Lu,files:Cu,materials:Wl,folderOpen:xu,chevronUp:Ql,chevronDown:Jl,members:fd,settings:J,refresh:Zu,chevron:Xl,file:yu,text:id,link:ku,attachment:Uu,imageFile:pu,spreadsheetFile:_u,codeFile:du,addText:ju,addFile:hu,download:su,code:nu,preview:lu,sparkles:nd,close:md,plus:Yu,edit:Gu,device:Vu,disable:ud,enable:od,reset:Tu,menu:Fu,logout:Nu,account:cd,copy:K,general:ed,connect:qu,model:au,check:Kl,search:q,notifications:Hl,attention:eu},Dd={small:16,normal:24,navigation:38};function Od({name:e,size:t=`normal`}){let n=Ed[e];return(0,U.jsx)(n,{className:`icon`,size:Dd[t],strokeWidth:2,absoluteStrokeWidth:!0,"aria-hidden":`true`})}function kd({label:e,icon:t,tooltip:n=t!==`refresh`,className:r=``,variant:i=`ghost`,...a}){return(0,U.jsx)(`button`,{type:`button`,...a,className:`icon-button ${i===`primary`?`primary`:``} ${r}`,"aria-label":e,"data-tooltip":n?e:void 0,children:(0,U.jsx)(Od,{name:t})})}var Ad=L([`planned`,`in_progress`,`in_review`,`completed`]),jd=I({title:M().trim(),goal:M().trim().nullable(),status:Ad.nullable(),progress:M().trim(),needsConfirmation:P().default(!1)}).strict(),Md=I({kind:L([`workspace`,`material`]).optional(),materialId:M().regex(/^R\d{6,}$/).optional(),path:Mc,sha256:Ac,revision:jc,syncedAt:M()}),Nd=jd.extend({id:ys(),owner:z,jobId:ys().nullable(),revision:jc.default(1),origin:L([`workspace`,`confirmed`]).default(`workspace`),sources:F(Md),syncedAt:M().nullable(),corrected:P(),needsReview:P()});I({expectedRevision:jc.optional(),title:jd.shape.title.optional(),status:Ad.nullable().optional(),goal:jd.shape.goal.optional(),progress:jd.shape.progress.optional(),needsConfirmation:P().optional()}).strict().refine(e=>Object.keys(e).some(e=>e!==`expectedRevision`),`Provide a correction.`);var Pd=I({tasks:F(Nd),members:F(I({owner:z,jobId:ys().nullable(),status:L([`empty`,`waiting`,`queued`,`running`,`succeeded`,`failed`,`cancelled`]),error:M().nullable(),sourceChanged:P(),uncertainties:F(M())})),modelAvailable:P()}),Fd=I({id:z,name:M().trim().min(1).max(120),protocol:L([`openai-completions`,`openai-responses`,`anthropic-messages`]),baseUrl:Bc,model:M().trim().min(1).max(200),enabled:P().default(!0)}).strict(),Id=Fd.safeExtend({revision:N().int(),keyConfigured:P()}),Ld=I({expectedRevision:N().int().nonnegative(),profile:Fd,apiKey:M().min(1).max(4096).nullable().optional()}).strict(),Rd=I({profiles:F(Id)});I({expectedRevision:N().int().nonnegative(),profileId:z.nullable()}).strict();var zd=I({revision:N().int().nonnegative(),profileId:z.nullable(),effectiveProfileId:z.nullable(),source:L([`site`,`project`,`none`]),available:P()}),Bd=I({mode:L([`text`,`tools`,`json`])}).strict(),Vd=I({ok:tc(!0),mode:Bd.shape.mode,streamed:P(),inputTokens:N(),outputTokens:N()}),Hd=I({owner:z,kind:L([`file`,`directory`]),path:Js([tc(``),Mc]),revision:N().int().nonnegative().optional()}).strict().refine(e=>e.kind===`directory`||e.path!==``,`A file path is required.`),Ud=I({operationId:ys(),profileId:z.optional(),workflow:L([`file-summary`,`directory-analysis`,`task-bootstrap`]),selection:Hd,question:M().trim().default(``)}).strict(),Wd=I({path:Mc,startLine:N().int().positive(),endLine:N().int().positive(),sha256:Ac}),Gd=I({totalFiles:N().int(),readFiles:F(Mc),accessTracking:tc(`unavailable`).optional(),limitations:F(M())}),Kd=Js([I({summary:M(),findings:F(M()),uncertainties:F(M()).default([]),citations:F(Wd),coverage:Gd}),I({kind:tc(`task-bootstrap`),updateMode:tc(`patch`).optional(),archive:F(ys()).optional(),tasks:F(jd.extend({taskId:ys().nullable().optional(),sources:F(Md)})),uncertainties:F(M()).optional(),coverage:Gd})]),qd=I({inputTokens:N().nonnegative(),outputTokens:N().nonnegative()}),Jd=I({id:ys(),requester:z,workflow:Ud.shape.workflow,question:M(),profileId:z,model:M(),profileRevision:N().int(),promptVersion:M(),origin:L([`manual`,`automatic`]).default(`manual`),status:L([`queued`,`running`,`succeeded`,`failed`,`cancelled`]),createdAt:M(),updatedAt:M(),attemptCount:N().int(),error:M().nullable(),input:I({owner:z,kind:L([`file`,`directory`]),path:M(),revision:N().int(),fileCount:N().int(),fingerprint:Ac}),result:Kd.nullable(),sourceChanged:P()});I({jobs:F(Jd),nextCursor:M().nullable()}),I({events:F(I({seq:N().int(),attempt:N().int(),kind:M(),message:M(),createdAt:M()})),nextCursor:N().int()}),I({job:Jd,attempts:F(I({number:N().int(),status:M(),startedAt:M(),endedAt:M().nullable(),error:M().nullable(),usage:qd.nullable()}))});var Yd=I({state:L([`unknown`,`online`,`offline`]),lastSeenAt:M().nullable()}),Xd=I({state:L([`unconfigured`,`pending`,`cloning`,`fetching`,`ready`,`failed`,`interrupted`]),lastSuccessAt:M().nullable()}),Zd=I({worker:Yd.shape.state,modelAvailable:P(),activities:F(I({kind:L([`repository`,`import`,`tasks`,`sessions`,`project`,`chat`]),state:L([`queued`,`running`,`failed`]),count:N().int().positive()}))}),Qd=I({state:L([`unknown`,`ready`,`failed`]),mode:L([`full`,`none`])}),$d=I({adminId:M(),publicServerUrl:M(),model:Fd.nullable(),modelKeyConfigured:P(),projectName:M(),repositoryUrl:M(),initialProjectId:M().nullable(),runtime:I({storage:tc(`ready`),worker:Yd,sandbox:Qd})});Ld.extend({usePresetKey:P().default(!1)});function ef({options:e,onDone:t}){let[n,r]=(0,R.useState)(e?.model??{id:`default`,name:`团队模型`,protocol:`openai-completions`,baseUrl:``,model:``,enabled:!0}),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(),[c,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)(``),[f,p]=(0,R.useState)(``),m=!o||[`protocol`,`baseUrl`,`model`].some(e=>n[e]!==o[e])||!!i;return(0,U.jsxs)(`form`,{className:`access-form`,"data-testid":`setup-model-form`,onSubmit:async t=>{t.preventDefault(),l(!0),d(``),p(``);try{let t=await V(`setup/model`,Id,{method:`POST`,body:{expectedRevision:o?.revision??0,profile:n,...i?{apiKey:i}:{},usePresetKey:!o&&!!e?.modelKeyConfigured&&e.model?.baseUrl===n.baseUrl&&e.model?.protocol===n.protocol}});s(t),a(``),p(`已保存为全站默认接入点。`)}catch(e){d(H(e))}finally{l(!1)}},children:[(0,U.jsx)(`h1`,{children:`连接模型`}),(0,U.jsx)(`p`,{children:`可稍后在设置中配置。`}),(0,U.jsxs)(`fieldset`,{className:`stack`,disabled:c,children:[(0,U.jsx)(Z,{id:`setup-model-protocol`,label:`协议`,children:(0,U.jsxs)(`select`,{value:n.protocol,onChange:e=>r({...n,protocol:e.target.value}),children:[(0,U.jsx)(`option`,{value:`openai-completions`,children:`OpenAI Chat Completions`}),(0,U.jsx)(`option`,{value:`openai-responses`,children:`OpenAI Responses`}),(0,U.jsx)(`option`,{value:`anthropic-messages`,children:`Anthropic Messages`})]})}),(0,U.jsx)(Z,{id:`setup-model-url`,label:`接入地址`,children:(0,U.jsx)(`input`,{required:!0,type:`url`,placeholder:`https://gateway.example/v1`,value:n.baseUrl,onChange:e=>r({...n,baseUrl:e.target.value})})}),(0,U.jsx)(Z,{id:`setup-model-id`,label:`模型 ID`,children:(0,U.jsx)(`input`,{required:!0,value:n.model,onChange:e=>r({...n,model:e.target.value})})}),(0,U.jsx)(Z,{id:`setup-model-key`,label:`API 密钥`,hint:o?.keyConfigured?`已保存;留空保留。`:e?.modelKeyConfigured?`部署已提供密钥;更换接入地址时请重新填写。`:`无需密钥的网关可以留空。`,children:(0,U.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:i,onChange:e=>a(e.target.value)})})]}),(0,U.jsx)(X,{error:!0,children:u}),(0,U.jsx)(X,{children:f}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{className:`primary`,disabled:c,"data-testid":`setup-model-save`,children:`保存`}),(0,U.jsx)(`button`,{type:`button`,disabled:c||m,onClick:async()=>{l(!0),d(``),p(``);try{await V(`ai/profiles/${n.id}/test`,Vd,{method:`POST`,body:{mode:`text`},timeoutMs:305e3}),p(`连接测试通过。`)}catch(e){d(H(e))}finally{l(!1)}},children:`测试连接`})]}),(0,U.jsx)(`button`,{type:`button`,disabled:c,"data-testid":`setup-finish`,onClick:t,children:o?`进入工作台`:`暂时跳过`})]})}function tf({children:e}){return(0,U.jsxs)(`div`,{className:`access`,children:[(0,U.jsxs)(`aside`,{className:`access-aside`,children:[(0,U.jsx)(hd,{}),(0,U.jsx)(`div`,{className:`access-art`,children:(0,U.jsx)(gd,{pose:`wave`})}),(0,U.jsx)(`div`,{className:`access-copy`,children:(0,U.jsx)(`h2`,{children:`工作有条理,团队用 Teammy`})})]}),(0,U.jsx)(`main`,{className:`access-main`,children:e})]})}function nf({onLogin:e}){let[t,n]=(0,R.useState)(``),[r,i]=(0,R.useState)(``),[a,o]=(0,R.useState)(!1);async function s(n){n.preventDefault(),o(!0),i(``);try{e(await ol.login(t.trim()))}catch(e){i(H(e))}finally{o(!1)}}return(0,U.jsx)(tf,{children:(0,U.jsxs)(`form`,{className:`access-form`,"data-testid":`login-form`,"aria-label":B.loginTitle,"aria-busy":a,onSubmit:s,children:[(0,U.jsx)(`h1`,{children:B.loginTitle}),(0,U.jsx)(`p`,{children:B.loginHint}),(0,U.jsx)(Z,{id:`login-member-id`,name:`memberId`,label:B.memberId,children:(0,U.jsx)(`input`,{autoFocus:!0,autoComplete:`username`,required:!0,maxLength:64,value:t,onChange:e=>n(e.target.value),placeholder:`caffei`})}),(0,U.jsx)(X,{error:!0,children:r}),(0,U.jsx)(`button`,{"data-testid":`login-submit`,className:`primary wide`,disabled:a,children:a?B.loading:B.login})]})})}var rf=`teammy:site-setup-draft-v2`,af=e=>V(`setup/options`,$d,{signal:e});function of(){try{let e=JSON.parse(sessionStorage.getItem(rf)??`null`);if(typeof e?.operationId==`string`&&typeof e?.adminId==`string`)return{operationId:e.operationId,adminId:e.adminId,publicServerUrl:p()}}catch{}return{operationId:ll(),adminId:``,publicServerUrl:p()}}function sf({onDone:e}){let[t,n]=(0,R.useState)(of),r=W(af,5e3),i=(0,R.useRef)(!1),[a,o]=(0,R.useState)();(0,R.useEffect)(()=>{r.data&&!i.current&&(i.current=!0,n(e=>({...e,adminId:e.adminId||r.data.adminId,publicServerUrl:r.data.publicServerUrl||e.publicServerUrl})))},[r.data]);let[s,c]=(0,R.useState)(``),[l,u]=(0,R.useState)(!1);(0,R.useEffect)(()=>{try{sessionStorage.setItem(rf,JSON.stringify(t))}catch{}},[t]);async function d(e){e.preventDefault(),c(``),u(!0);try{let e=await V(`setup`,qc,{method:`POST`,body:Uc.parse({...t,adminId:t.adminId.trim(),publicServerUrl:t.publicServerUrl})});try{sessionStorage.removeItem(rf)}catch{}o(e)}catch(e){c(H(e))}finally{u(!1)}}return a?(0,U.jsx)(tf,{children:(0,U.jsx)(ef,{options:r.data,onDone:()=>e(a)})}):(0,U.jsx)(tf,{children:(0,U.jsxs)(`form`,{className:`access-form`,"data-testid":`setup-form`,"aria-label":`创建管理员`,"aria-busy":l,onSubmit:d,children:[(0,U.jsx)(`h1`,{children:`欢迎使用 Teammy`}),(0,U.jsx)(`p`,{children:`创建管理员,开始管理项目与成员。`}),(0,U.jsx)(Z,{id:`setup-admin-id`,name:`adminId`,label:B.adminId,hint:B.idHint,children:(0,U.jsx)(`input`,{required:!0,autoFocus:!0,autoComplete:`username`,pattern:`[a-z][a-z0-9_\\-]{0,63}`,maxLength:64,value:t.adminId,onChange:e=>n({...t,adminId:e.target.value}),placeholder:`caffei`,disabled:l})}),r.data&&(0,U.jsxs)(`div`,{className:`setup-runtime`,role:`status`,children:[(0,U.jsx)(`span`,{children:`存储已连接`}),(0,U.jsx)(`span`,{children:r.data.runtime.worker.state===`online`?`后台运行中`:`后台尚未就绪`}),(0,U.jsx)(`span`,{children:{ready:`隔离环境可用`,failed:`隔离环境检查失败`,unknown:`隔离环境检查中`}[r.data.runtime.sandbox.state]})]}),(0,U.jsx)(X,{error:!0,children:s||r.error}),(0,U.jsx)(`button`,{"data-testid":`setup-submit`,className:`primary wide`,disabled:l,children:l?B.saving:`创建管理员`})]})})}var cf=M().regex(/^[a-f0-9]{64}$/);I({id:ys(),projectId:z,deviceId:Ec,secret:cf,label:M().min(1).max(255)}).strict(),I({id:ys(),expiresAt:N()});var lf=Xs(`state`,[I({state:tc(`pending`)}),I({state:tc(`approved`),memberId:z})]),uf=I({projectName:M(),label:M(),approvedBy:z.nullable(),expiresAt:N()});function df({session:e,onLogout:t}){let n=new URLSearchParams(location.search).get(`request`)??``,r=W((0,R.useCallback)(e=>V(`devices/connect/${encodeURIComponent(n)}`,uf,{signal:e}),[n])),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(``),u=o||r.data?.approvedBy===e.memberId;return(0,U.jsx)(tf,{children:(0,U.jsxs)(`form`,{className:`access-form`,"data-testid":`client-connect-form`,onSubmit:async e=>{e.preventDefault(),a(!0),l(``);try{await V(`devices/connect/${encodeURIComponent(n)}/approve`,lf,{method:`POST`}),s(!0)}catch(e){l(H(e))}finally{a(!1)}},children:[(0,U.jsx)(`h1`,{children:u?`身份已确认`:`连接工作目录`}),r.data&&(0,U.jsxs)(`p`,{children:[(0,U.jsx)(`strong`,{children:r.data.projectName}),(0,U.jsx)(`br`,{}),r.data.label]}),u?(0,U.jsx)(`p`,{role:`status`,children:`请返回终端继续连接。`}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{children:[`使用 `,(0,U.jsx)(`strong`,{children:e.displayName||e.memberId}),e.displayName&&e.displayName!==e.memberId?`(${e.memberId})`:` `,`连接此项目。`]}),(0,U.jsx)(X,{error:!0,children:c||r.error}),r.loading&&!r.data&&(0,U.jsx)(`p`,{role:`status`,children:`加载中…`}),(0,U.jsx)(`button`,{className:`primary wide`,disabled:i||!r.data||!!r.error,"data-testid":`client-connect-approve`,children:i?`正在确认…`:`确认连接`}),(0,U.jsx)(`button`,{type:`button`,className:`wide`,disabled:i,onClick:async()=>{try{await ol.logout(),t()}catch(e){l(H(e))}},children:`更换用户`})]})]})})}function ff(){let[e]=(0,R.useState)(()=>{let e=460+Math.random()*140;return{"--selection-duration":`${e}ms`,"--selection-tail-delay":`${e*.82}ms`,"--selection-tail-duration":`${80+Math.random()*40}ms`,"--selection-easing":`cubic-bezier(${.22+Math.random()*.12}, 0.05, ${.12+Math.random()*.14}, 1)`}});return(0,U.jsxs)(`svg`,{className:`selection-mark`,style:e,viewBox:`0 0 240 56`,preserveAspectRatio:`none`,"aria-hidden":`true`,focusable:`false`,children:[(0,U.jsx)(`path`,{d:`M216 9 C177 3 97 6 48 7 C22 7 9 12 8 26 C7 42 26 48 57 47 L174 48 C205 48 226 43 229 30 C232 18 220 10 200 8`,vectorEffect:`non-scaling-stroke`,strokeWidth:`2.1`,pathLength:`1`}),(0,U.jsx)(`path`,{className:`selection-mark-tail`,d:`M199 8 C211 8 224 11 231 17`,vectorEffect:`non-scaling-stroke`,strokeWidth:`1.3`,pathLength:`1`})]})}function Q(e){return e[`aria-selected`]===!0||e[`aria-selected`]===`true`||e[`aria-current`]===`page`||e[`aria-pressed`]===!0||e[`aria-pressed`]===`true`}function pf({children:e,selected:t,variant:n=`hand-drawn`}){return(0,U.jsxs)(`span`,{className:`selection-content`,children:[t&&n===`hand-drawn`&&(0,U.jsx)(ff,{}),(0,U.jsx)(`span`,{className:`selection-inner`,children:e})]})}function mf({children:e,className:t=``,leading:n,variant:r=`hand-drawn`,...i}){return(0,U.jsxs)(`button`,{type:`button`,...i,className:`selection-item ${t}`,"data-selection-variant":r,"data-selected":Q(i)||void 0,children:[n,(0,U.jsx)(pf,{selected:Q(i),variant:r,children:e})]})}function hf({children:e,className:t=``,leading:n,variant:r=`hand-drawn`,...i}){return(0,U.jsxs)(`a`,{...i,className:`selection-item ${t}`,"data-selection-variant":r,"data-selected":Q(i)||void 0,children:[n,(0,U.jsx)(pf,{selected:Q(i),variant:r,children:e})]})}function gf({prefix:e,tabs:t,selected:n,onSelect:r,orientation:i=`vertical`}){return(0,U.jsx)(`div`,{className:`settings-tabs`,role:`tablist`,"aria-orientation":i,"aria-label":`设置分类`,onKeyDown:e=>{let t=[...e.currentTarget.querySelectorAll(`[role="tab"]`)],n=t.indexOf(e.target);if(n<0)return;let r=e.key===`ArrowRight`||e.key===`ArrowDown`?(n+1)%t.length:e.key===`ArrowLeft`||e.key===`ArrowUp`?(n+t.length-1)%t.length:e.key===`Home`?0:e.key===`End`?t.length-1:void 0;r!==void 0&&(e.preventDefault(),t[r].click(),t[r].focus())},children:t.map(t=>(0,U.jsxs)(mf,{id:`${e}-tab-${t.id}`,role:`tab`,"data-testid":`${e}-tab-${t.id}`,"aria-controls":`${e}-panel-${t.id}`,"aria-selected":n===t.id,tabIndex:n===t.id?0:-1,onClick:()=>r(t.id),children:[(0,U.jsx)(Od,{name:t.icon}),(0,U.jsx)(`span`,{children:t.title})]},t.id))})}function _f(e){let t=`projects/${encodeURIComponent(e)}`,n=(e,n,r)=>V(`${t}/${e}`,n,r);return{projectId:e,request:n,api:sl(n),blobUrl:e=>d(`/api/v1/${t}/blobs/${e}`),readTextBlob:(e,n)=>ul(e,n,`/api/v1/${t}`)}}var vf=(0,R.createContext)(null);function yf(){let e=(0,R.useContext)(vf);if(!e)throw Error(`Project context is required.`);return e}function bf({action:e,onClose:t,onSaved:n}){let{request:r}=yf(),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(e.kind===`add`?``:e.member.displayName),[c,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)(``),f=e.kind===`add`?B.addMember:e.kind===`name`?B.editName:`退出项目`;return(0,U.jsx)(Cd,{id:`member-dialog`,title:f,onClose:c?()=>{}:t,children:(0,U.jsxs)(`form`,{"data-testid":`member-form`,"data-action":e.kind,"data-member-id":e.kind===`add`?void 0:e.member.id,"aria-label":f,"aria-busy":c,className:`stack`,onSubmit:async t=>{t.preventDefault(),l(!0),d(``);try{e.kind===`add`?await r(`web/members`,Kc,{method:`POST`,body:Yc.parse({id:i})}):e.kind===`leave`?await r(`membership`,I({ok:P()}),{method:`DELETE`}):await r(`web/members/${e.member.id}`,Kc,{method:`PATCH`,body:Xc.parse({expectedRevision:e.member.revision,displayName:o})}),await n()}catch(e){d(H(e))}finally{l(!1)}},children:[e.kind===`add`&&(0,U.jsx)(Z,{id:`member-id`,name:`memberId`,label:B.memberId,hint:B.idHint,children:(0,U.jsx)(`input`,{autoFocus:!0,required:!0,maxLength:64,value:i,onChange:e=>a(e.target.value),disabled:c})}),e.kind===`name`&&(0,U.jsx)(Z,{id:`member-display-name`,name:`displayName`,label:B.displayName,hint:`仅用于当前项目。`,children:(0,U.jsx)(`input`,{autoFocus:!0,maxLength:120,value:o,onChange:e=>s(e.target.value),disabled:c})}),e.kind===`leave`&&(0,U.jsx)(`p`,{children:`退出后停止同步该项目,已经共享的资料会保留。`}),(0,U.jsx)(X,{error:!0,children:u}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{type:`button`,"data-testid":`member-cancel`,disabled:c,onClick:t,children:B.cancel}),(0,U.jsx)(`button`,{className:`primary`,"data-testid":`member-submit`,disabled:c,children:c?B.saving:e.kind===`leave`?`退出项目`:B.confirm})]})]})})}function xf({members:e,session:t,reload:n,onLeave:r}){let[i,a]=(0,R.useState)(),o=e.filter(e=>e.enabled&&e.accountEnabled);return(0,U.jsxs)(`div`,{className:`settings-section`,children:[(0,U.jsx)(bd,{title:`成员`,count:o.length,children:(0,U.jsxs)(xd,{label:`成员操作`,children:[(0,U.jsx)(kd,{icon:`refresh`,label:`刷新成员`,"data-testid":`members-refresh`,onClick:n}),(0,U.jsx)(kd,{icon:`plus`,variant:`primary`,label:B.addMember,"data-testid":`member-add`,onClick:()=>a({kind:`add`})})]})}),(0,U.jsx)(`div`,{className:`member-list`,children:o.map(e=>(0,U.jsxs)(`article`,{"data-testid":`member-card`,"data-member-id":e.id,"aria-label":e.displayName,className:`member-card`,children:[(0,U.jsxs)(`div`,{className:`member-heading`,children:[(0,U.jsx)(_d,{name:e.displayName}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{children:e.displayName}),(0,U.jsx)(`small`,{children:e.id})]})]}),(0,U.jsxs)(`div`,{className:`member-actions`,children:[(0,U.jsx)(kd,{icon:`edit`,label:B.editName,"data-testid":`member-edit-name`,onClick:()=>a({kind:`name`,member:e})}),e.id===t.memberId&&(0,U.jsx)(kd,{icon:`logout`,label:`退出项目`,"data-testid":`project-leave`,onClick:()=>a({kind:`leave`,member:e})})]})]},e.id))}),i&&(0,U.jsx)(bf,{action:i,onClose:()=>a(void 0),onSaved:async()=>{i.kind===`leave`?await r():(a(void 0),n())}})]})}function Sf({id:e,label:t,trigger:n,triggerId:r,className:i=``,routeKey:a,children:o}){let[s,c]=(0,R.useState)(!1),l=(0,R.useRef)(null),u=(0,R.useRef)(null),d=(0,R.useRef)(!1);return(0,R.useEffect)(()=>c(!1),[a]),(0,R.useEffect)(()=>{if(!s)return;let e=l.current?.querySelectorAll(`[role="menuitem"]`);e?.[d.current?e.length-1:0]?.focus();let t=e=>{l.current?.contains(e.target)||c(!1)};return document.addEventListener(`pointerdown`,t),()=>document.removeEventListener(`pointerdown`,t)},[s]),(0,U.jsxs)(`div`,{className:`dropdown ${i}`,ref:l,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||c(!1)},onKeyDown:e=>{e.key===`Escape`&&s&&(e.stopPropagation(),c(!1),u.current?.focus())},children:[(0,U.jsx)(`button`,{ref:u,className:`dropdown-trigger`,"data-testid":r,"aria-label":t,"aria-haspopup":`menu`,"aria-expanded":s,"aria-controls":e,onClick:()=>{d.current=!1,c(!s)},onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),d.current=e.key===`ArrowUp`,c(!0))},children:n}),s&&(0,U.jsx)(`div`,{id:e,className:`dropdown-menu`,role:`menu`,"aria-label":t,"data-testid":e,onKeyDown:e=>{let t=[...e.currentTarget.querySelectorAll(`[role="menuitem"]:not(:disabled)`)],n=t.indexOf(document.activeElement),r=e.key===`ArrowDown`?(n+1)%t.length:e.key===`ArrowUp`?(n+t.length-1)%t.length:e.key===`Home`?0:e.key===`End`?t.length-1:void 0;r!==void 0&&(e.preventDefault(),t[r]?.focus())},children:o(()=>{c(!1),u.current?.focus()})})]})}var Cf={repository:`同步中`,import:`导入中`,tasks:`整理中`,sessions:`整理中`,project:`分析中`,chat:`回复中`};function wf(e,t){if(t)return{state:`failed`,text:`异常`};if(!e)return{state:`idle`,text:`读取中`};if(e.worker===`offline`)return{state:`failed`,text:`离线`};if(e.worker===`unknown`)return{state:`idle`,text:`待启动`};if(e.activities.some(e=>e.state===`failed`))return{state:`failed`,text:`异常`};let n=e.activities.filter(e=>e.state===`running`),r=n.reduce((e,t)=>e+t.count,0);return r?{state:`running`,text:r===1?Cf[n[0].kind]:`处理中`}:e.modelAvailable?e.activities.some(e=>e.state===`queued`)?{state:`queued`,text:`待处理`}:{state:`idle`,text:`空闲`}:{state:`idle`,text:`待配置`}}function Tf({projectId:e}){let t=W((0,R.useCallback)(t=>V(`projects/${encodeURIComponent(e)}/project/activity`,Zd,{signal:t}),[e]),3e3),n=wf(t.data,t.error);return(0,U.jsxs)(`span`,{className:`project-activity`,"data-state":n.state,"data-testid":`project-activity`,role:`status`,"aria-live":`polite`,children:[(0,U.jsx)(`span`,{className:`project-activity-dot`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{className:`project-activity-label`,children:n.text})]})}var Ef=[`dashboard`,`assistant`,`files`,`materials`,`sessions`,`settings`],Df=(e,t)=>`/projects/${encodeURIComponent(e)}/${t}`,Of={dashboard:`看板`,assistant:`Tim`,files:`工作区`,materials:`资料`,sessions:B.sessions,settings:`设置`};function kf({projectId:e,page:t,navigate:n}){let r=W((0,R.useCallback)(t=>e?V(`projects/${encodeURIComponent(e)}/agents/outbox/unread`,I({unread:N()}),{signal:t}):Promise.resolve({unread:0}),[e]),5e3);(0,R.useEffect)(()=>{let e=()=>void r.reload();return window.addEventListener(`teammy:outbox`,e),()=>window.removeEventListener(`teammy:outbox`,e)},[r.reload]);function i(e,t){e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),n(t))}return(0,U.jsxs)(`aside`,{id:`workspace-navigation`,className:`sidebar`,children:[(0,U.jsx)(`a`,{className:`brand-home`,"data-testid":`home-link`,href:d(`/projects`),"aria-label":`项目主页`,"aria-current":t===`projects`?`page`:void 0,onClick:e=>i(e,`/projects`),children:(0,U.jsx)(hd,{compact:!0})}),e&&(0,U.jsx)(`nav`,{"aria-label":B.navigation,children:Ef.map(n=>(0,U.jsxs)(hf,{variant:`inverse`,href:d(Df(e,n)),"data-testid":`nav-${n}`,"aria-label":Of[n],"aria-current":t===n?`page`:void 0,onClick:t=>i(t,Df(e,n)),children:[(0,U.jsx)(Od,{name:n,size:`navigation`}),(0,U.jsx)(`span`,{className:`navigation-label`,children:Of[n]}),n===`assistant`&&!!r.data?.unread&&(0,U.jsx)(`span`,{className:`navigation-unread`,role:`img`,"aria-label":`${r.data.unread} 条未读消息`})]},n))}),e&&(0,U.jsx)(Tf,{projectId:e},e)]})}function Af({session:e,navigate:t,onLogout:n,routeKey:r}){let[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(``);return(0,U.jsx)(Sf,{id:`account-menu`,triggerId:`account-menu-trigger`,className:`account-menu-wrap`,label:`用户菜单 · ${e.displayName}`,trigger:(0,U.jsx)(`strong`,{children:e.displayName}),routeKey:r,children:e=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`button`,{role:`menuitem`,"data-testid":`account-settings`,onClick:()=>{e(),t(`/site-settings`)},children:[(0,U.jsx)(Od,{name:`settings`}),`设置`]}),(0,U.jsxs)(`button`,{role:`menuitem`,"data-testid":`logout`,disabled:i,onClick:async()=>{a(!0),s(``);try{await ol.logout(),n()}catch(e){s(H(e)),a(!1)}},children:[(0,U.jsx)(Od,{name:`logout`}),`退出登录`]}),(0,U.jsx)(X,{error:!0,children:o})]})})}function jf({session:e,navigate:t,onLogout:n,routeKey:r,children:i}){return(0,U.jsxs)(`div`,{className:`site-page`,children:[(0,U.jsxs)(`header`,{className:`site-brand-header`,children:[(0,U.jsx)(`a`,{href:d(`/projects`),"aria-label":`项目主页`,"data-testid":`home-link`,onClick:e=>{e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),t(`/projects`))},children:(0,U.jsx)(hd,{})}),(0,U.jsx)(Af,{session:e,navigate:t,onLogout:n,routeKey:r})]}),i]})}function Mf({title:e,navigation:t,children:n}){return(0,U.jsxs)(`div`,{className:`split-layout settings-layout`,children:[(0,U.jsxs)(`aside`,{className:`settings-navigation`,children:[(0,U.jsx)(Sd,{title:e}),t]}),(0,U.jsx)(`div`,{className:`settings-content`,children:n})]})}function Nf({title:e,icon:t,count:n,children:r}){return(0,U.jsxs)(`header`,{className:`explorer-heading`,children:[(0,U.jsxs)(`h1`,{children:[t&&(0,U.jsx)(Od,{name:t}),e,n!==void 0&&(0,U.jsx)(vd,{children:n})]}),r]})}var Pf=`_project`;Js([z,tc(Pf)]);var Ff=M().max(255).refine(e=>{let t=e.endsWith(`/`),n=t?e.slice(0,-1):e;return Mc.safeParse(n).success&&!n.includes(`/`)&&!n.startsWith(`.`)&&!/^_?teammy/i.test(n)&&(t?n.startsWith(`_`):n.includes(`.`))},`Use a root file (README.md) or an underscore-prefixed directory (_template/).`),If=I({maintainer:z.nullable(),paths:F(Ff).max(30).refine(e=>new Set(e.map(e=>e.toLowerCase())).size===e.length),revision:jc}).strict();If.omit({revision:!0}).extend({expectedRevision:jc}).strict();function Lf(e){return e.split(`/`).some(e=>/^\.teammy(?:[-.]|$)/i.test(e))}function Rf({members:e}){let{request:t}=yf(),n=W((0,R.useCallback)(e=>t(`project/shared-files`,If,{signal:e}),[t])),[r,i]=(0,R.useState)(``);return(0,U.jsxs)(`section`,{className:`settings-section stack`,"aria-label":`公共资料`,children:[(0,U.jsx)(`h2`,{children:`公共资料`}),(0,U.jsx)(X,{error:!0,children:n.error}),n.data&&(0,U.jsx)(zf,{config:n.data,members:e,reload:async()=>{await n.reload(),i(`公共资料设置已保存`)}},n.data.revision),(0,U.jsx)(X,{children:r})]})}function zf({config:e,members:t,reload:n}){let{request:r}=yf(),[i,a]=(0,R.useState)(e.maintainer??``),[o,s]=(0,R.useState)(e.paths.join(`
|
|
65
65
|
`)),[c,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)(``);return(0,U.jsxs)(`form`,{className:`stack`,"aria-label":`公共资料设置`,onSubmit:async e=>{e.preventDefault(),l(!0),d(``);try{let e=await r(`project/shared-files`,If);await r(`project/shared-files`,If,{method:`PATCH`,body:{expectedRevision:e.revision,maintainer:i||null,paths:o.split(`
|
|
66
|
-
`).map(e=>e.trim()).filter(Boolean)}}),await n()}catch(e){d(H(e))}finally{l(!1)}},children:[(0,U.jsxs)(`fieldset`,{disabled:c,className:`stack`,children:[(0,U.jsx)(Z,{id:`shared-files-maintainer`,label:`维护成员`,children:(0,U.jsxs)(`select`,{value:i,onChange:e=>a(e.target.value),children:[(0,U.jsx)(`option`,{value:``,children:`暂停发布`}),t.map(e=>(0,U.jsx)(`option`,{value:e.id,disabled:!e.enabled||!e.accountEnabled,children:e.displayName||e.id},e.id))]})}),(0,U.jsx)(Z,{id:`shared-files-paths`,label:`公共资料路径`,hint:`每行一个根目录文件或以下划线开头的文件夹;例如 README.md、_template/。由维护成员更新,其他成员自动接收。`,children:(0,U.jsx)(`textarea`,{rows:3,value:o,onChange:e=>s(e.target.value)})})]}),(0,U.jsx)(X,{error:!0,children:u}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{className:`primary`,disabled:c,children:`保存公共资料设置`})})]})}I({text:M().trim().min(1),requestId:M().min(1).optional()}).strict(),I({body:M().trim().min(1),requestId:M().min(1).optional()}).strict(),I({to:Js([tc(`debug`),F(z).min(1)]),body:M().trim().min(1),branch:M().trim().min(1).optional()}).strict();var Bf=N().int().positive().nullable(),$=L([`github`,`gongfeng`]),Vf={github:`https://api.github.com`,gongfeng:`https://git.tencent.com/api/v3`},Hf=I({provider:$.default(`github`),repositoryUrl:M().trim().default(``),repository:M().trim().default(``),apiUrl:M().url().optional(),githubApiUrl:M().url().optional(),debugRecipient:z.nullable().default(null),contextWindow:N().int().positive().default(256e3),compactAt:N().int().positive().default(22e4),fetchIntervalSeconds:Bf.default(300),idleSeconds:Bf.default(1800),restartSeconds:Bf.default(86400)}).strict().refine(e=>e.compactAt<e.contextWindow,`压缩阈值应小于模型上下文窗口。`).transform(({githubApiUrl:e,apiUrl:t,...n})=>({...n,apiUrl:(t??e??Vf[n.provider]).replace(/\/+$/,``)}));I({config:Hf,token:M().nullable().optional(),webhookSecret:M().nullable().optional(),sshPrivateKey:M().nullable().optional(),sshKnownHosts:M().nullable().optional()}).strict();var Uf=I({config:Hf,tokenConfigured:P(),webhookConfigured:P(),sshConfigured:P(),sshPublicKey:M().nullable().optional(),webhookUrl:M().optional()}),Wf=I({id:M(),name:M(),url:M()}),Gf=I({id:M(),text:M(),answer:M(),author:M().nullable().optional(),source:tc(`wecom`).optional(),state:L([`queued`,`running`,`succeeded`,`failed`]),error:M().nullable(),createdAt:M()}),Kf=I({id:M(),seq:N(),runId:M().nullable(),role:L([`user`,`assistant`]),author:M(),body:M(),state:Gf.shape.state,source:M().nullable(),createdAt:M()}),qf=I({chats:F(I({id:M(),title:M(),kind:L([`matter`,`notice`]).optional(),status:L([`active`,`waiting`,`completed`]).optional(),unread:P().optional(),createdAt:M(),updatedAt:M(),state:Gf.shape.state.nullable()}))}),Jf=I({id:M(),title:M().optional(),runs:F(Gf),messages:F(Kf),readCursor:N(),redirect:M().nullable().optional(),kind:L([`matter`,`notice`]).optional(),status:L([`active`,`waiting`,`completed`]).optional(),pending:I({members:F(M()),question:M()}).nullable().optional(),hold:I({scope:L([`all`,`writes`]),reason:M()}).passthrough().nullable().optional(),participants:F(M()).optional(),visibility:L([`project`,`participants`]).optional(),cursor:N()}),Yf=I({id:M(),body:M(),box:L([`normal`,`debug`]),taskId:N().nullable(),createdAt:M(),readAt:M().nullable(),archivedAt:M().nullable(),conversationId:M().nullable(),recipients:F(I({userId:M()}))}),Xf=I({messages:F(Yf),unread:N()}),Zf=e=>V(`site/worker-status`,Yd,{signal:e}),Qf=()=>W(Zf,5e3);function $f(){let e=Qf(),t=e.data;return(0,U.jsxs)(`div`,{className:`settings-section`,children:[(0,U.jsx)(`h2`,{children:`后台服务`}),(0,U.jsx)(X,{error:!0,children:e.error}),(0,U.jsx)(`p`,{role:`status`,"data-testid":`worker-status`,children:t?{online:`运行中`,offline:`暂未响应`,unknown:`未检测到后台服务`}[t.state]:`正在读取…`}),t?.lastSeenAt&&t.state!==`online`&&(0,U.jsxs)(`p`,{className:`muted`,children:[`最近响应:`,new Date(t.lastSeenAt).toLocaleString()]}),t&&t.state!==`online`&&(0,U.jsx)(`p`,{className:`muted`,children:`请检查部署中的 ai-worker 是否已启动。`})]})}function ep({generation:e}){let{request:t}=yf(),n=W((0,R.useCallback)(e=>t(`agents/repository/status`,Xd,{signal:e}),[t,e]),5e3),r=n.data,i=r&&[`pending`,`cloning`,`fetching`].includes(r.state),a=r&&[`failed`,`interrupted`].includes(r.state);return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(X,{error:!0,children:n.error}),(0,U.jsxs)(`div`,{className:`repository-status-card${i?` active`:``}${a?` error`:``}`,role:`status`,children:[(0,U.jsx)(Od,{name:a?`attention`:r?.state===`ready`?`check`:`download`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{"data-testid":`repository-status`,children:r?{unconfigured:`尚未配置仓库`,pending:`等待后台下载仓库`,cloning:`正在下载仓库`,fetching:`正在拉取远端更新`,ready:`仓库已下载`,failed:`仓库下载失败`,interrupted:`仓库下载已中断`}[r.state]:`正在读取仓库状态…`}),i&&(0,U.jsx)(`p`,{children:`包含默认启用的子模块,可离开此页,后台会继续处理。`}),r?.state===`failed`&&(0,U.jsx)(`p`,{children:`请查看诊断日志,确认主仓库及子模块的访问权限与网络连接。`}),r?.state===`interrupted`&&(0,U.jsx)(`p`,{children:`等待后台重试。`}),r?.lastSuccessAt&&(0,U.jsxs)(`p`,{children:[`最近完成:`,new Date(r.lastSuccessAt).toLocaleString()]})]})]})]})}function tp({members:e}){let{request:t,projectId:n}=yf(),r=W((0,R.useCallback)(e=>t(`agents/settings`,Uf,{signal:e}),[t])),[i,a]=(0,R.useState)(0),[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(()=>Hf.parse({})),[u,d]=(0,R.useState)(``),[f,m]=(0,R.useState)(``),[h,g]=(0,R.useState)(``),[_,v]=(0,R.useState)(``),[y,b]=(0,R.useState)(!1),[ee,te]=(0,R.useState)(``),[ne,re]=(0,R.useState)(!1),[x,ie]=(0,R.useState)(``);(0,R.useEffect)(()=>{r.data&&(l(r.data.config),s(r.data.sshPublicKey??null))},[r.data]),(0,R.useEffect)(()=>{if(!r.data||r.data.config.repositoryUrl)return;let e=new AbortController;return V(`setup/options`,$d,{signal:e.signal}).then(e=>{!e.repositoryUrl||e.initialProjectId&&e.initialProjectId!==n||l(t=>{if(t.repositoryUrl)return t;let n=e.repositoryUrl,r=n.includes(`git.tencent.com`)?`gongfeng`:t.provider,i=n.replace(/^[^@]+@[^:]+:/,``).replace(/^https?:\/\/[^/]+\//,``).replace(/\.git$/,``);return{...t,repositoryUrl:n,repository:i,provider:r,apiUrl:Vf[r]}})}).catch(()=>{}),()=>e.abort()},[!!r.data,n]);async function S(e,n=!1){e?.preventDefault(),b(!0),te(``),re(!1),ie(``);try{await t(`agents/settings`,Uf,{method:`PUT`,body:{config:c,...u?{token:u}:{},...f?{webhookSecret:f}:{},...h?{sshPrivateKey:h}:{},..._?{sshKnownHosts:_}:{}}}),d(``),m(``),g(``),v(``),await r.reload(),a(e=>e+1),re(!0),n&&(await t(`agents/repository/transport-check`,I({ok:P()}),{method:`POST`,timeoutMs:305e3}),ie(`远端连接检查通过。完整下载及子模块状态见上方,工作区将在下载完成后导入。`))}catch(e){te(H(e))}finally{b(!1)}}return(0,U.jsx)(`div`,{className:`settings-section`,children:(0,U.jsxs)(`form`,{className:`stack`,onSubmit:e=>void S(e),"data-testid":`project-agent-settings`,children:[(0,U.jsxs)(`fieldset`,{className:`stack`,disabled:y||r.loading,children:[(0,U.jsx)(`h2`,{children:`仓库连接`}),(0,U.jsx)(ep,{generation:i}),(0,U.jsx)(`p`,{className:`muted`,children:`请配置仓库连接、访问密钥及 PR/MR 评论账号;评论可使用管理员账号。`}),(0,U.jsx)(Z,{id:`agent-provider`,label:`Git 平台`,children:(0,U.jsxs)(`select`,{value:c.provider,onChange:e=>{let t=e.target.value;l({...c,provider:t,apiUrl:Vf[t]}),ie(``)},children:[(0,U.jsx)(`option`,{value:`github`,children:`GitHub`}),(0,U.jsx)(`option`,{value:`gongfeng`,children:`工蜂`})]})}),(0,U.jsx)(Z,{id:`agent-repository-url`,label:`仓库地址`,children:(0,U.jsx)(`input`,{value:c.repositoryUrl,placeholder:c.provider===`gongfeng`?`https://git.tencent.com/group/repository.git`:`https://github.com/owner/repository.git`,onChange:e=>l({...c,repositoryUrl:e.target.value}),onBlur:()=>{if(!c.repository){let e=``;try{e=new URL(c.repositoryUrl).pathname}catch{e=c.repositoryUrl.match(/^[^@]+@[^:]+:(.+)$/)?.[1]??``}e&&l({...c,repository:e.replace(/^\/+|\/+$/g,``).replace(/\.git$/,``)})}}})}),(0,U.jsx)(Z,{id:`agent-repository`,label:c.provider===`gongfeng`?`工蜂仓库`:`GitHub 仓库`,children:(0,U.jsx)(`input`,{value:c.repository,placeholder:c.provider===`gongfeng`?`group/repository 或项目 ID`:`owner/repository`,onChange:e=>l({...c,repository:e.target.value})})}),(0,U.jsx)(Z,{id:`agent-api-url`,label:`API 地址`,children:(0,U.jsx)(`input`,{type:`url`,value:c.apiUrl,onChange:e=>l({...c,apiUrl:e.target.value})})}),(0,U.jsx)(Z,{id:`agent-token`,label:`访问与评论令牌`,hint:c.provider===`gongfeng`?`使用具有 api 权限的个人访问令牌;HTTPS 拉取还需 read_repository 权限。`:`令牌需具备仓库读取和发表评论权限。`,children:(0,U.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:u,placeholder:r.data?.tokenConfigured?`已配置;留空保持现状`:``,onChange:e=>d(e.target.value)})}),(0,U.jsx)(Z,{id:`agent-debug-recipient`,label:`运行提醒收件人`,children:(0,U.jsxs)(`select`,{value:c.debugRecipient??``,onChange:e=>l({...c,debugRecipient:e.target.value||null}),children:[(0,U.jsx)(`option`,{value:``,children:`管理员`}),e.filter(e=>e.enabled&&e.accountEnabled).map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.displayName||e.id},e.id))]})}),(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{children:`PR/MR 事件接入`}),(0,U.jsxs)(`div`,{className:`stack`,children:[(0,U.jsx)(wd,{id:`agent-webhook-url`,label:`Webhook 地址`,value:r.data?.webhookUrl??`${p()}/api/v1/projects/${encodeURIComponent(n)}/agents/${c.provider}/events`}),(0,U.jsx)(Z,{id:`agent-webhook-secret`,label:`Webhook Secret`,children:(0,U.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:f,placeholder:r.data?.webhookConfigured?`已配置;留空保持现状`:``,onChange:e=>m(e.target.value)})}),(0,U.jsx)(`p`,{className:`muted`,children:c.provider===`gongfeng`?`订阅合并请求、评论和评审事件,填写相同秘密令牌,并在工蜂中测试、激活 Webhook。建议先保存并检查仓库。`:`在仓库中使用 JSON webhook,订阅 Pull requests、Issue comments、Pull request reviews 和 Pull request review comments。`})]})]}),(0,U.jsxs)(`section`,{className:`stack`,children:[(0,U.jsx)(`h3`,{children:`项目 SSH 公钥`}),o&&(0,U.jsx)(wd,{id:`agent-ssh-public-key`,label:c.provider===`gongfeng`?`复制到工蜂账号的 SSH 密钥中`:`复制到 GitHub 仓库的 Deploy keys 中`,value:o}),!o&&(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{type:`button`,"data-testid":`agent-generate-key`,disabled:y,onClick:async()=>{b(!0),te(``);try{let e=await t(`agents/repository/ssh-key`,Uf,{method:`POST`});s(e.sshPublicKey??null)}catch(e){te(H(e))}finally{b(!1)}},children:`生成项目公钥`})}),(0,U.jsxs)(`small`,{children:[c.provider===`gongfeng`?`使用 SSH 仓库地址时,将公钥添加到工蜂的「个人设置 → SSH 密钥」,访问权限继承该账号。`:`使用 SSH 仓库地址时,将公钥添加到 GitHub 仓库的「Settings → Deploy keys」。`,`首次连接记录主机公钥,后续变化会拒绝连接。`]})]}),(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{children:`已有 SSH 凭据`}),(0,U.jsxs)(`div`,{className:`stack`,children:[(0,U.jsx)(Z,{id:`agent-ssh-key`,label:`SSH 私钥`,children:(0,U.jsx)(`textarea`,{rows:3,value:h,placeholder:r.data?.sshConfigured?`已配置;留空保持现状`:``,onChange:e=>g(e.target.value)})}),(0,U.jsx)(Z,{id:`agent-ssh-hosts`,label:`已确认的服务器公钥(known_hosts)`,children:(0,U.jsx)(`textarea`,{rows:2,value:_,onChange:e=>v(e.target.value)})})]})]}),(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{children:`运行设置`}),(0,U.jsxs)(`div`,{className:`form-grid`,children:[(0,U.jsx)(Z,{id:`agent-context-window`,label:`模型上下文窗口(tokens)`,children:(0,U.jsx)(`input`,{type:`number`,value:c.contextWindow,onChange:e=>l({...c,contextWindow:Number(e.target.value)})})}),(0,U.jsx)(Z,{id:`agent-compact-at`,label:`提前压缩位置(tokens)`,children:(0,U.jsx)(`input`,{type:`number`,value:c.compactAt,onChange:e=>l({...c,compactAt:Number(e.target.value)})})}),[[`fetchIntervalSeconds`,`仓库 fetch 间隔(秒)`],[`idleSeconds`,`额外 Pi 进程空闲回收(秒)`],[`restartSeconds`,`空闲时重建沙箱的周期(秒)`]].map(([e,t])=>(0,U.jsx)(Z,{id:`agent-${e}`,label:t,hint:`留空关闭;不打断正在执行的回答。`,children:(0,U.jsx)(`input`,{type:`number`,value:c[e]??``,onChange:t=>l({...c,[e]:t.target.value?Number(t.target.value):null})})},e))]})]})]}),(0,U.jsx)(X,{error:!0,children:ee||r.error}),(0,U.jsx)(X,{children:x||(ne?`已保存。`:null)}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{className:`primary`,disabled:y||r.loading,children:`保存`}),(0,U.jsx)(`button`,{type:`button`,disabled:y||r.loading||!c.repositoryUrl,onClick:()=>void S(void 0,!0),children:`保存并检查仓库`}),(0,U.jsx)(`button`,{type:`button`,disabled:y||!c.repository,onClick:async()=>{b(!0),te(``),ie(``);try{let e=await t(`agents/repository/check`,Wf,{method:`POST`,timeoutMs:305e3});ie(`工蜂 / GitHub API 可读:${e.name}。`)}catch(e){te(H(e))}finally{b(!1)}},children:`检查已保存的 API 配置`})]})]})})}var np=Xs(`kind`,[I({kind:tc(`repository`),path:M().trim().min(1)}).strict(),I({kind:tc(`directory`),path:M().trim().min(1)}).strict()]),rp=I({members:F(M()),fileCount:N().int().nonnegative(),preserved:F(M()),skipped:F(M())}),ip=I({state:L([`none`,`pending`,`running`,`succeeded`,`failed`]),source:np.nullable(),result:rp.nullable(),error:M().nullable()});function ap({onImported:e}){let{request:t}=yf(),n=W((0,R.useCallback)(e=>t(`project/workspace-import`,ip,{signal:e}),[t]),5e3),r=Qf(),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(``),u=n.data,d=u?.state===`succeeded`?JSON.stringify(u):null,f=(0,R.useRef)(null);(0,R.useEffect)(()=>{let t=f.current!==d;f.current=d,d&&t&&e()},[d,e]),(0,R.useEffect)(()=>{u?.source?.kind===`directory`&&a(u.source.path)},[u?.source?.kind,u?.source?.path]);async function p(e=!1){s(!0),l(``);try{await t(`project/workspace-import`,ip,{method:`POST`,body:e?u?.source:{kind:`directory`,path:i.trim()}}),await n.reload()}catch(e){l(H(e))}finally{s(!1)}}let m=u?.state===`pending`||u?.state===`running`;return(0,U.jsxs)(`div`,{className:`settings-section`,"data-testid":`workspace-import-settings`,children:[(0,U.jsx)(`h2`,{children:`工作区初始化`}),(0,U.jsx)(`p`,{className:`muted`,children:`连接仓库后自动导入其中的 workspaces,也可从服务器目录导入。原文件和已有同步版本保留。`}),u?.state!==`none`&&u&&(0,U.jsxs)(`div`,{role:`status`,"data-testid":`workspace-import-status`,children:[u.state===`pending`&&`等待后台导入`,u.state===`running`&&(r.data?.state===`online`?`正在导入工作区`:`等待后台继续导入`),u.state===`succeeded`&&`已识别 ${u.result?.members.length??0} 位成员,导入 ${u.result?.fileCount??0} 个文件。`,u.source&&(0,U.jsx)(`p`,{className:`muted`,children:u.source.path}),!!u.result?.preserved.length&&(0,U.jsxs)(`p`,{className:`muted`,children:[`保留已有版本:`,u.result.preserved.map(e=>e===`_project`?`公共资料`:e).join(`、`)]}),!!u.result?.skipped.length&&(0,U.jsxs)(`p`,{className:`muted`,children:[`未纳入同步范围:`,u.result.skipped.join(`、`)]})]}),m&&r.data&&r.data.state!==`online`&&(0,U.jsx)(`p`,{className:`muted`,children:`后台服务暂未响应,请检查 ai-worker 是否已启动。`}),(0,U.jsx)(X,{error:!0,children:u?.error||n.error||c}),u?.state===`failed`&&(0,U.jsx)(`button`,{disabled:o,onClick:()=>void p(!0),children:`重试导入`}),(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{children:`从服务器目录导入`}),(0,U.jsxs)(`form`,{className:`stack`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,U.jsx)(Z,{id:`import-workspace-path`,label:`工作区路径`,hint:`容器部署时填写只读挂载后的路径,例如 /imports/utu/workspaces。`,children:(0,U.jsx)(`input`,{required:!0,value:i,placeholder:`/imports/utu/workspaces`,disabled:o||m,onChange:e=>a(e.target.value)})}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{disabled:o||m||!i.trim(),children:`导入工作区`})})]})]})]})}var op=e=>V(`ai/profiles`,Rd,{signal:e});function sp({projectId:e,title:t,profiles:n,admin:r,generation:i,onChanged:a}){let o=e?`projects/${encodeURIComponent(e)}/ai/default`:`ai/default`,s=W((0,R.useCallback)(e=>V(o,zd,{signal:e}),[o,i]));return(0,U.jsxs)(`div`,{className:`model-default-row`,"data-testid":`ai-default-row`,"data-scope":e??`site`,children:[(0,U.jsx)(X,{error:!0,children:s.error}),s.data?(0,U.jsx)(cp,{value:s.data,path:o,id:e??`site`,title:t,profiles:n,admin:r,onChanged:()=>{s.reload(),a()},reload:()=>void s.reload()},`${s.data.revision}/${s.data.effectiveProfileId}/${s.data.available}`):(0,U.jsx)(`span`,{role:`status`,children:`正在加载…`}),s.error&&(0,U.jsx)(`button`,{onClick:()=>void s.reload(),children:`重试`})]})}function cp({value:e,path:t,id:n,title:r,profiles:i,admin:a,onChanged:o,reload:s}){let[c,l]=(0,R.useState)(e.profileId??``),[u,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(``),m=vl(),h=i.find(t=>t.id===e.effectiveProfileId);return(0,U.jsxs)(`form`,{"aria-label":`${r}默认接入点`,"aria-busy":u,onSubmit:async n=>{n.preventDefault(),d(!0),p(``);try{await V(t,zd,{method:`PUT`,signal:m,body:{expectedRevision:e.revision,profileId:c||null}}),o()}catch(e){m.aborted||p(H(e))}finally{d(!1)}},children:[(0,U.jsxs)(`div`,{className:`model-default-controls`,children:[(0,U.jsx)(Z,{id:`ai-default-${n}`,label:r,children:(0,U.jsxs)(`select`,{disabled:!a||u,value:c,onChange:e=>l(e.target.value),children:[(0,U.jsx)(`option`,{value:``,children:n===`site`?`未设置`:`继承全站默认${e.source===`site`&&h?` · ${h.name}`:``}`}),i.map(e=>(0,U.jsxs)(`option`,{value:e.id,disabled:!e.enabled,children:[e.name,e.enabled?``:`(已停用)`]},e.id))]})}),a&&(0,U.jsx)(kd,{icon:`check`,type:`submit`,label:`保存${r}默认接入点`,"data-testid":`ai-default-save`,disabled:u||c===(e.profileId??``)})]}),(0,U.jsx)(`p`,{className:`muted`,role:`status`,"data-testid":`ai-default-status-${n}`,children:e.available?`已配置 · ${h?.name??e.effectiveProfileId}`:e.effectiveProfileId?`接入点已停用`:`尚未配置默认接入点`}),!e.available&&e.effectiveProfileId&&(0,U.jsx)(X,{error:!0,children:`默认接入点已停用,请重新选择。`}),(0,U.jsx)(X,{error:!0,children:f}),f&&(0,U.jsx)(`button`,{type:`button`,onClick:s,disabled:u,children:`重新载入`})]})}function lp(){let{projectId:e}=yf(),t=W(op),[n,r]=(0,R.useState)(0);return(0,U.jsxs)(`section`,{className:`settings-section`,"aria-label":`模型接入`,children:[(0,U.jsx)(`h2`,{children:`模型接入`}),(0,U.jsx)(X,{error:!0,children:t.error}),t.data&&(0,U.jsx)(sp,{projectId:e,title:`项目默认`,profiles:t.data.profiles,admin:!0,generation:n,onChanged:()=>r(e=>e+1)})]})}I({enabled:P(),botId:M().trim().min(1),secret:M().trim().min(1).optional()}).strict();var up=I({enabled:P(),botId:M(),secretConfigured:P(),state:L([`disabled`,`connecting`,`connected`,`disconnected`,`error`]),error:M().nullable(),pending:N()}),dp=I({available:P(),bound:P(),subscribed:P(),activeProject:M().nullable(),pending:N(),error:M().nullable()}),fp=I({code:M(),expiresAt:N()}),pp=I({groups:F(I({id:M(),boundBy:M(),createdAt:M()}))}),mp=I({channels:F(I({id:M(),name:M()})),selected:M().nullable(),selectedName:M().nullable(),missingMentions:F(M()),refreshing:P(),updatedAt:N().nullable(),error:M().nullable(),pending:N()}),hp=e=>V(`site/wecom`,up,{signal:e}),gp={disabled:`未启用`,connecting:`连接中`,connected:`已连接`,disconnected:`未连接`,error:`连接异常`};function _p(){let e=W(hp,3e3),[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(``),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(``),[l,u]=(0,R.useState)(``),d=e.data,f=t??{botId:d?.botId??``,enabled:d?.enabled??!0};async function p(){o(!0),c(``),u(``);try{await V(`site/wecom`,up,{method:`PUT`,body:{...f,...r?{secret:r}:{}}}),i(``),n(null),await e.reload(),u(`已保存,连接状态会自动更新。`)}catch(e){c(H(e))}finally{o(!1)}}return(0,U.jsxs)(`div`,{className:`settings-section stack`,"data-testid":`wecom-site-settings`,children:[(0,U.jsx)(`h2`,{children:`企业微信机器人`}),(0,U.jsx)(`p`,{className:`muted`,children:`将Tim的消息转发到企业微信。原消息与回复仍保存在网页中。`}),(0,U.jsx)(X,{error:!0,children:e.error||s}),(0,U.jsxs)(`form`,{className:`stack`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,U.jsxs)(`fieldset`,{className:`stack`,disabled:a||!d,children:[(0,U.jsx)(Z,{id:`wecom-bot-id`,label:`Bot ID`,children:(0,U.jsx)(`input`,{required:!0,value:f.botId,onChange:e=>n({...f,botId:e.target.value})})}),(0,U.jsx)(Z,{id:`wecom-secret`,label:`Secret`,children:(0,U.jsx)(`input`,{type:`password`,autoComplete:`new-password`,required:!d?.secretConfigured||f.botId!==d.botId,value:r,placeholder:d?.secretConfigured?`已保存,留空保持不变`:`填写长连接专用 Secret`,onChange:e=>i(e.target.value)})}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{type:`button`,role:`switch`,"aria-label":`启用企业微信`,"aria-checked":f.enabled,className:f.enabled?`primary`:``,onClick:()=>n({...f,enabled:!f.enabled}),children:f.enabled?`已启用`:`已停用`})})]}),(0,U.jsx)(X,{children:l}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{className:`primary`,disabled:a||!d,children:a?`保存中…`:`保存`})})]}),(0,U.jsxs)(`p`,{role:`status`,children:[d?gp[d.state]:`加载中…`,d?.pending?` · ${d.pending} 条待转发`:``]}),(0,U.jsx)(X,{error:!0,children:d?.error??``}),(0,U.jsx)(`p`,{className:`muted`,children:`使用 API 模式的长连接机器人。保存后,成员可在项目设置中绑定账号。`})]})}function vp(){let{request:e}=yf(),t=W((0,R.useCallback)(t=>e(`wecom/channels`,mp,{signal:t}),[e]),3e3),[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(``),c=t.data,l=n??c?.selected??``;async function u(n){a(!0),s(``);try{await e(n?`wecom/channels/refresh`:`wecom/channels`,mp,{method:n?`POST`:`PUT`,...n?{}:{body:{topicId:l||null}}}),n||r(null),await t.reload()}catch(e){s(H(e))}finally{a(!1)}}return(0,U.jsxs)(`section`,{className:`stack`,"data-testid":`wecom-channel-settings`,children:[(0,U.jsx)(`h3`,{children:`项目频道`}),(0,U.jsx)(`p`,{className:`muted`,children:`每件事项独立成帖,按需 @ 相关成员,回复与网页同步。频道成员均可查看共享事项。`}),(0,U.jsx)(X,{error:!0,children:o||t.error||c?.error||``}),(0,U.jsx)(Z,{id:`wecom-channel`,label:`接收事项的频道`,children:(0,U.jsxs)(`select`,{value:l,disabled:i||!c,onChange:e=>r(e.target.value),children:[(0,U.jsx)(`option`,{value:``,children:`暂不连接频道`}),c?.selected&&!c.channels.some(e=>e.id===c.selected)&&(0,U.jsxs)(`option`,{value:c.selected,children:[c.selectedName,`(暂不可用)`]}),c?.channels.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{disabled:i||!c||c.refreshing,onClick:()=>void u(!0),children:c?.refreshing?`刷新中…`:`刷新`}),(0,U.jsx)(`button`,{className:`primary`,disabled:i||!c||l===(c.selected??``),onClick:()=>void u(!1),children:`保存`})]}),(0,U.jsx)(`p`,{className:`muted`,children:`机器人需允许获取所有内容、主动发送。仅发布新建共享事项,已有私人内容不会自动公开。`}),c?.missingMentions.length?(0,U.jsxs)(`p`,{className:`muted`,children:[`暂无法 @:`,c.missingMentions.join(`、`),`。成员完成下方个人绑定并加入频道后即可生效。`]}):null,c?.pending?(0,U.jsxs)(`p`,{className:`muted`,children:[c.pending,` 条频道消息待发送。`]}):null]})}function yp(){let{request:e}=yf(),t=W((0,R.useCallback)(t=>e(`wecom`,dp,{signal:t}),[e]),3e3),[n,r]=(0,R.useState)(),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(``);(0,R.useEffect)(()=>{t.data?.subscribed&&r(void 0)},[t.data?.subscribed]);async function c(n=!1){a(!0),s(``);try{n?(await e(`wecom`,dp,{method:`DELETE`}),r(void 0)):r(await e(`wecom/code`,fp,{method:`POST`})),await t.reload()}catch(e){s(H(e))}finally{a(!1)}}let l=t.data;return(0,U.jsxs)(`div`,{className:`settings-section stack`,"data-testid":`wecom-project-settings`,children:[(0,U.jsx)(`h2`,{children:`企业微信`}),(0,U.jsx)(`p`,{children:`接收本项目的新消息,并在企业微信中与Tim对话。原消息、回答与回复仍保存在网页。`}),(0,U.jsx)(X,{error:!0,children:t.error||o}),l?.available&&(0,U.jsx)(vp,{}),l?.available&&(0,U.jsx)(`h3`,{children:`个人绑定`}),l?l.available?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{role:`status`,children:[l.subscribed?`个人账号已连接本项目`:`尚未绑定个人账号`,l.pending?` · ${l.pending} 条待转发`:``]}),(0,U.jsx)(X,{error:!0,children:l.error??``}),l.subscribed?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`muted`,children:`引用通知回复即可同步到网页。直接提问进入独立对话;发送 /new 开始新话题,/projects 查看项目,/help 查看全部命令。`}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{disabled:i,onClick:()=>void c(!0),children:`解除本项目连接`})})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`muted`,children:`获取绑定码后,在企业微信中私聊机器人,发送下面的绑定消息。绑定码 10 分钟内有效。`}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{className:`primary`,disabled:i,onClick:()=>void c(),children:i?`生成中…`:n?`重新生成绑定码`:`获取绑定码`})}),n&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(wd,{id:`wecom-bind-command`,label:`绑定消息`,value:`/bind ${n.code}`}),(0,U.jsxs)(`p`,{className:`muted`,children:[`有效至 `,new Date(n.expiresAt).toLocaleTimeString(),`。绑定后自动更新此页面,历史通知仍可在网页查看。`]})]})]})]}):(0,U.jsx)(`p`,{className:`muted`,children:`请管理员先在全局设置中配置企业微信机器人。`}):(0,U.jsx)(`p`,{className:`muted`,children:`加载中…`}),l?.available&&(0,U.jsx)(bp,{})]})}function bp(){let{request:e}=yf(),t=W((0,R.useCallback)(t=>e(`wecom/groups`,pp,{signal:t}),[e]),3e3),[n,r]=(0,R.useState)(),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(``);async function c(){a(!0),s(``);try{r(await e(`wecom/groups/code`,fp,{method:`POST`}))}catch(e){s(H(e))}finally{a(!1)}}async function l(n){a(!0),s(``);try{await e(`wecom/groups/${encodeURIComponent(n)}`,pp,{method:`DELETE`}),await t.reload()}catch(e){s(H(e))}finally{a(!1)}}return(0,U.jsxs)(`section`,{className:`stack`,"data-testid":`wecom-group-settings`,children:[(0,U.jsx)(`h3`,{children:`群接入`}),(0,U.jsx)(`p`,{className:`muted`,children:`将机器人加入群,在群内发送绑定命令。绑定后,群内成员均可 @Tim 提问或分析项目资料,无需个人绑定。`}),(0,U.jsx)(X,{error:!0,children:o||t.error}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{disabled:i,onClick:()=>void c(),children:i?`处理中…`:`获取群绑定码`})}),n&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(wd,{id:`wecom-group-bind-command`,label:`在群内 @Tim 后发送`,value:`/bind ${n.code}`}),(0,U.jsxs)(`p`,{className:`muted`,children:[`有效至 `,new Date(n.expiresAt).toLocaleTimeString(),`。`]})]}),t.data?.groups.map(e=>(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsxs)(`span`,{children:[e.id,` · `,e.boundBy]}),(0,U.jsx)(`button`,{disabled:i,onClick:()=>void l(e.id),children:`解除群连接`})]},e.id)),(0,U.jsx)(`p`,{className:`muted`,children:`群内 /new 开始新话题,/help 查看命令。群聊天不在网页留存;明确收录的资料会保存在本项目。`})]})}function xp({config:e,session:t,reload:n,members:r,onLeave:i,initialTab:a}){let{request:o}=yf(),s=[{id:`general`,title:`基础设置`,icon:`general`},...t.siteRole===`admin`?[{id:`repository`,title:`代码仓库`,icon:`code`}]:[],{id:`members`,title:`成员`,icon:`members`},{id:`connect`,title:`客户端接入`,icon:`connect`},{id:`wecom`,title:`企业微信`,icon:`message`}],[c,l]=(0,R.useState)(a&&s.some(e=>e.id===a)?a:`general`),[u,f]=(0,R.useState)(e),[p,m]=(0,R.useState)(!1),[h,g]=(0,R.useState)(``),[_,v]=(0,R.useState)(``);async function y(){m(!0),g(``),v(``);try{let e=await o(`project/config`,Hc,{method:`PATCH`,body:Gc.parse({projectName:u.projectName,description:u.description})});f(e),v(B.configSaved),n()}catch(e){g(H(e))}finally{m(!1)}}return(0,U.jsxs)(Mf,{title:B.settings,navigation:(0,U.jsx)(gf,{prefix:`settings`,selected:c,onSelect:e=>{l(e);let t=new URL(location.href);e===`general`?t.searchParams.delete(`tab`):t.searchParams.set(`tab`,e),history.replaceState(null,``,t)},tabs:s}),children:[(0,U.jsx)(`section`,{id:`settings-panel-wecom`,role:`tabpanel`,"aria-labelledby":`settings-tab-wecom`,hidden:c!==`wecom`,children:c===`wecom`&&(0,U.jsx)(yp,{})}),(0,U.jsxs)(`section`,{id:`settings-panel-general`,role:`tabpanel`,"aria-labelledby":`settings-tab-general`,hidden:c!==`general`,children:[(0,U.jsxs)(`div`,{className:`settings-section`,children:[(0,U.jsx)(`span`,{hidden:!0,"data-testid":`saved-config-version`,"data-config-revision":e.configRevision}),(0,U.jsxs)(`form`,{"data-testid":`project-settings-form`,"aria-label":B.project,"aria-busy":p,"data-baseline-revision":u.configRevision,className:`stack`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,U.jsxs)(`fieldset`,{disabled:p,className:`stack`,children:[(0,U.jsx)(`h2`,{children:`项目信息`}),(0,U.jsx)(Z,{id:`project-name`,name:`projectName`,label:B.projectName,children:(0,U.jsx)(`input`,{required:!0,maxLength:120,value:u.projectName,onChange:e=>f({...u,projectName:e.target.value})})}),(0,U.jsx)(Z,{id:`project-description`,name:`description`,label:B.description,children:(0,U.jsx)(`textarea`,{rows:3,maxLength:2e3,value:u.description,onChange:e=>f({...u,description:e.target.value})})})]}),(0,U.jsx)(X,{error:!0,children:h}),(0,U.jsx)(X,{children:_}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{"data-testid":`settings-save`,className:`primary`,disabled:p,children:p?B.saving:B.save})})]})]}),(0,U.jsx)(lp,{}),(0,U.jsx)(Rf,{members:r}),t.siteRole===`admin`&&(0,U.jsx)(ap,{onImported:n})]}),t.siteRole===`admin`&&(0,U.jsx)(`section`,{id:`settings-panel-repository`,role:`tabpanel`,"aria-labelledby":`settings-tab-repository`,hidden:c!==`repository`,children:(0,U.jsx)(tp,{members:r})}),(0,U.jsx)(`section`,{id:`settings-panel-members`,role:`tabpanel`,"aria-labelledby":`settings-tab-members`,hidden:c!==`members`,children:(0,U.jsx)(xf,{members:r,session:t,reload:n,onLeave:i})}),(0,U.jsxs)(`section`,{id:`settings-panel-connect`,role:`tabpanel`,"aria-labelledby":`settings-tab-connect`,hidden:c!==`connect`,children:[(0,U.jsxs)(`div`,{className:`settings-section connect-panel`,children:[(0,U.jsx)(`h2`,{children:B.connectTitle}),(0,U.jsx)(`p`,{children:B.connectHint}),(0,U.jsx)(wd,{id:`connect-command`,label:B.connectCommand,value:`teammy connect --url ${cl(e.publicServerUrl)} --project ${cl(e.projectId)}`}),(0,U.jsx)(`p`,{children:B.connectAfter})]}),(0,U.jsxs)(`div`,{className:`settings-section connect-panel`,children:[(0,U.jsx)(`h2`,{children:B.install}),(0,U.jsx)(`p`,{children:B.installHint}),(0,U.jsx)(wd,{id:`install-command`,label:B.installCommandLabel,value:`npm install -g @teammy/cli`})]}),(0,U.jsxs)(`div`,{className:`settings-section connect-panel`,children:[(0,U.jsx)(`h2`,{children:`Agent 接入`}),(0,U.jsx)(`p`,{children:`通过 MCP 查询项目资料,或委托Tim处理工作。`}),(0,U.jsx)(`a`,{href:d(`/downloads/teammy-skill.zip`),download:!0,children:`下载 Teammy skill`})]})]})]})}function Sp({projects:e,session:t,onOpen:n,reload:r}){let[i,a]=(0,R.useState)(!1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Sd,{title:`我的项目`,children:(0,U.jsxs)(xd,{label:`项目操作`,children:[(0,U.jsx)(kd,{icon:`refresh`,label:`刷新项目`,onClick:()=>void r()}),t.siteRole===`admin`&&(0,U.jsxs)(`button`,{className:`primary`,"data-testid":`project-add`,onClick:()=>a(!0),children:[(0,U.jsx)(Od,{name:`plus`}),`新建项目`]})]})}),(0,U.jsx)(`div`,{className:`project-list`,children:e.map(e=>(0,U.jsxs)(`button`,{className:`project-card`,"data-testid":`project-row`,"data-project-id":e.projectId,onClick:()=>n(e.projectId),children:[(0,U.jsx)(Od,{name:`files`,size:`navigation`}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`strong`,{children:e.projectName}),e.description&&(0,U.jsx)(`small`,{children:e.description})]}),(0,U.jsx)(Od,{name:`chevron`})]},e.projectId))}),!e.length&&(0,U.jsx)(yd,{mascot:!0,title:`还没有项目`,description:t.siteRole===`admin`?`创建第一个项目,开始协作。`:`请项目成员添加你的 ID。`,children:t.siteRole===`admin`&&(0,U.jsxs)(`button`,{className:`primary`,"data-testid":`project-add-empty`,onClick:()=>a(!0),children:[(0,U.jsx)(Od,{name:`plus`}),`新建项目`]})}),i&&(0,U.jsx)(Cp,{onClose:()=>a(!1),onCreated:async e=>{await r(),a(!1),n(e)}})]})}function Cp({onClose:e,onCreated:t}){let[n,r]=(0,R.useState)(``),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(``),[c,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)(``),f=(0,R.useRef)({fingerprint:``,id:ll()});return(0,R.useEffect)(()=>{let e=new AbortController;return V(`setup/options`,$d,{signal:e.signal}).then(e=>{e.initialProjectId||r(t=>t||e.projectName)}).catch(()=>{}),()=>e.abort()},[]),(0,U.jsx)(Cd,{id:`project-create-dialog`,title:`新建项目`,onClose:c?()=>{}:e,children:(0,U.jsxs)(`form`,{className:`stack`,"data-testid":`project-create-form`,onSubmit:async e=>{e.preventDefault(),l(!0),d(``);try{let e=JSON.stringify([n,i,o]);f.current.fingerprint!==e&&(f.current={fingerprint:e,id:ll()}),await t((await V(`projects`,Hc,{method:`POST`,body:{operationId:f.current.id,projectName:n,description:i,...o.trim()?{workspacePath:o.trim()}:{}}})).projectId)}catch(e){d(H(e))}finally{l(!1)}},children:[(0,U.jsxs)(`fieldset`,{className:`stack`,disabled:c,children:[(0,U.jsx)(Z,{id:`new-project-name`,label:`项目名称`,children:(0,U.jsx)(`input`,{required:!0,autoFocus:!0,maxLength:120,value:n,onChange:e=>r(e.target.value)})}),(0,U.jsx)(Z,{id:`new-project-description`,label:`说明`,children:(0,U.jsx)(`textarea`,{maxLength:2e3,value:i,onChange:e=>a(e.target.value)})}),(0,U.jsx)(Z,{id:`new-project-workspace`,label:`已有工作区(可选)`,hint:`填写服务器或容器内的 workspaces 绝对路径。Git 仓库可在创建后到项目设置中连接。`,children:(0,U.jsx)(`input`,{value:o,placeholder:`/imports/utu/workspaces`,onChange:e=>s(e.target.value)})})]}),(0,U.jsx)(X,{error:!0,children:u}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{type:`button`,disabled:c,onClick:e,children:`取消`}),(0,U.jsx)(`button`,{className:`primary`,disabled:c,children:`创建项目`})]})]})})}function wp({admin:e,profiles:t,error:n,reload:r}){let[i,a]=(0,R.useState)(),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(0);return(0,U.jsxs)(`section`,{className:`settings-section stack`,"data-testid":`ai-profiles`,children:[(0,U.jsxs)(`div`,{className:`section-heading`,children:[(0,U.jsx)(`h2`,{children:`模型接入`}),e&&(0,U.jsx)(kd,{icon:`plus`,label:`添加模型`,"data-testid":`ai-profile-new`,onClick:()=>{a(void 0),s(!0),l(e=>e+1)}})]}),(0,U.jsx)(X,{error:!0,children:n}),n&&(0,U.jsx)(`button`,{onClick:()=>r(),children:`重新加载模型`}),t?.length===0&&(0,U.jsx)(`p`,{children:`尚未配置模型。`}),t?.map(t=>(0,U.jsxs)(`div`,{className:`application-row ai-model-row`,"data-testid":`ai-profile-row`,"data-profile-id":t.id,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:t.name}),(0,U.jsxs)(`small`,{children:[t.model,` · `,t.enabled?`已启用`:`已停用`]})]}),e&&(0,U.jsx)(kd,{icon:`edit`,label:`配置 ${t.name}`,onClick:()=>{a(t),s(!0),l(e=>e+1)}})]},t.id)),e&&o&&(0,U.jsx)(Ep,{initial:i,onSaved:e=>{a(e),r()},onClose:()=>s(!1)},c),!e&&(0,U.jsx)(`small`,{children:`由管理员维护接入点和密钥。`})]})}function Tp(e){let{revision:t,keyConfigured:n,...r}=e;return Fd.parse(r)}function Ep({initial:e,onSaved:t,onClose:n}){let[r,i]=(0,R.useState)(e?Tp(e):Fd.parse({id:`default`,name:`团队模型`,protocol:`openai-completions`,baseUrl:`http://localhost:8000/v1`,model:`model`})),a=vl(),[o,s]=(0,R.useState)(e),[c,l]=(0,R.useState)(``),[u,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(!1),[m,h]=(0,R.useState)(``),[g,_]=(0,R.useState)(``),v=!o||JSON.stringify(r)!==JSON.stringify(Tp(o))||!!c||u;async function y(){p(!0),h(``),_(``);try{let e=await V(`ai/profiles/${encodeURIComponent(r.id)}`,Id,{method:`PUT`,signal:a,body:Ld.parse({expectedRevision:o?.revision??0,profile:r,...u?{apiKey:null}:c?{apiKey:c}:{}})});s(e),l(``),d(!1),t(e),_(`模型设置已保存。`)}catch(e){h(H(e))}finally{p(!1)}}async function b(){p(!0),h(``),_(``);try{let e=(await op(a)).profiles.find(e=>e.id===o?.id);e&&(s(e),i(Tp(e)),l(``),d(!1),t(e))}catch(e){a.aborted||h(H(e))}finally{p(!1)}}async function ee(e){p(!0),h(``),_(``);try{let t=await V(`ai/profiles/${encodeURIComponent(r.id)}/test`,Vd,{method:`POST`,body:{mode:e},timeoutMs:305e3});_(`${{text:`文本`,tools:`工具往返`,json:`JSON 样例`}[e]}测试通过 · 输入 ${t.inputTokens} / 输出 ${t.outputTokens} token`)}catch(e){h(H(e))}finally{p(!1)}}return(0,U.jsxs)(`form`,{className:`stack`,"data-testid":`ai-profile-form`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,U.jsxs)(`fieldset`,{className:`stack`,disabled:f,children:[(0,U.jsxs)(`div`,{className:`form-grid`,children:[(0,U.jsx)(Z,{id:`ai-profile-id`,label:`模型配置 ID`,children:(0,U.jsx)(`input`,{required:!0,value:r.id,disabled:!!o,onChange:e=>i({...r,id:e.target.value})})}),(0,U.jsx)(Z,{id:`ai-profile-name`,label:`模型名称`,children:(0,U.jsx)(`input`,{required:!0,maxLength:120,value:r.name,onChange:e=>i({...r,name:e.target.value})})})]}),(0,U.jsx)(Z,{id:`ai-profile-protocol`,label:`网关协议`,children:(0,U.jsxs)(`select`,{value:r.protocol,onChange:e=>i({...r,protocol:e.target.value}),children:[(0,U.jsx)(`option`,{value:`openai-completions`,children:`OpenAI Chat Completions`}),(0,U.jsx)(`option`,{value:`openai-responses`,children:`OpenAI Responses`}),(0,U.jsx)(`option`,{value:`anthropic-messages`,children:`Anthropic Messages`})]})}),(0,U.jsx)(Z,{id:`ai-profile-url`,label:`网关地址`,hint:`例如 https://gateway.example/v1;由服务器连接此地址。`,children:(0,U.jsx)(`input`,{required:!0,type:`url`,value:r.baseUrl,onChange:e=>i({...r,baseUrl:e.target.value})})}),(0,U.jsx)(Z,{id:`ai-profile-model`,label:`模型 ID`,children:(0,U.jsx)(`input`,{required:!0,maxLength:200,value:r.model,onChange:e=>i({...r,model:e.target.value})})}),(0,U.jsx)(Z,{id:`ai-profile-key`,label:`API 密钥`,hint:o?.keyConfigured?`已配置;留空保留原密钥。`:`可留空,适用于无需密钥的网关。`,children:(0,U.jsx)(`input`,{type:`password`,autoComplete:`new-password`,maxLength:4096,value:c,disabled:u,onChange:e=>l(e.target.value)})}),o?.keyConfigured&&(0,U.jsxs)(`label`,{children:[(0,U.jsx)(`input`,{type:`checkbox`,"data-testid":`ai-profile-clear-key`,checked:u,onChange:e=>d(e.target.checked)}),` `,`清除已保存密钥`]}),(0,U.jsxs)(`label`,{children:[(0,U.jsx)(`input`,{type:`checkbox`,"data-testid":`ai-profile-enabled`,checked:r.enabled,onChange:e=>i({...r,enabled:e.target.checked})}),` `,`允许创建分析任务`]})]}),(0,U.jsx)(X,{error:!0,children:m}),(0,U.jsx)(X,{children:g}),(0,U.jsxs)(`div`,{className:`row wrap`,children:[(0,U.jsx)(`button`,{className:`primary`,"data-testid":`ai-profile-save`,disabled:f,children:`保存模型`}),(0,U.jsx)(`button`,{type:`button`,disabled:f,onClick:n,children:`关闭配置`})]}),(0,U.jsx)(`div`,{className:`row wrap`,children:[`text`,`tools`,`json`].map(e=>(0,U.jsx)(`button`,{type:`button`,"data-testid":`ai-probe-${e}`,disabled:f||v,onClick:()=>void ee(e),children:{text:`测试文本`,tools:`测试工具`,json:`测试 JSON`}[e]},e))}),o&&(0,U.jsx)(`button`,{type:`button`,"data-testid":`ai-profile-reload`,disabled:f,onClick:()=>void b(),children:`重新载入模型配置`}),(0,U.jsx)(`small`,{children:`测试使用已保存配置和合成内容。JSON 测试仅校验本次样例。`})]})}var Dp=e=>V(`site/config`,Qc,{signal:e});function Op(){let e=W(Dp);return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(X,{error:!0,children:e.error}),e.data&&(0,U.jsx)(Ap,{config:e.data,reload:()=>void e.reload()}),e.data&&(0,U.jsx)(kp,{config:e.data,reload:()=>void e.reload()},e.data.revision),e.error&&(0,U.jsx)(`button`,{onClick:()=>void e.reload(),children:`重试`})]})}function kp({config:e,reload:t}){let[n,r]=(0,R.useState)(e.sync),[i,a]=(0,R.useState)(e.revision),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(``),[u,d]=(0,R.useState)(``);return(0,R.useEffect)(()=>{r(e.sync),a(e.revision),l(``),d(``)},[e]),(0,U.jsx)(`form`,{className:`stack`,"data-testid":`site-sync-form`,"aria-busy":o,"data-config-revision":i,onSubmit:async e=>{e.preventDefault(),s(!0),l(``),d(``);try{let e=await V(`site/config`,Qc,{method:`PATCH`,body:$c.parse({expectedRevision:i,sync:n})});a(e.revision),r(e.sync),d(`已保存,应用于所有项目。`)}catch(e){l(H(e))}finally{s(!1)}},children:(0,U.jsxs)(`section`,{className:`settings-section stack`,children:[(0,U.jsx)(`h2`,{children:`同步策略`}),(0,U.jsxs)(`fieldset`,{disabled:o,className:`form-grid`,children:[(0,U.jsx)(Z,{id:`sync-check-interval`,label:B.interval,children:(0,U.jsx)(`input`,{required:!0,type:`number`,min:1,max:86400,value:n.checkIntervalSeconds,onChange:e=>r({...n,checkIntervalSeconds:Number(e.target.value)})})}),(0,U.jsx)(Z,{id:`sync-file-settle`,label:B.settle,children:(0,U.jsx)(`input`,{required:!0,type:`number`,min:0,max:86400,value:n.fileSettleSeconds,onChange:e=>r({...n,fileSettleSeconds:Number(e.target.value)})})})]}),(0,U.jsx)(X,{error:!0,children:c}),(0,U.jsx)(X,{children:u}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{type:`button`,"aria-label":`刷新同步策略`,"data-testid":`site-sync-refresh`,disabled:o,onClick:t,children:`刷新`}),(0,U.jsx)(`button`,{className:`primary`,"data-testid":`site-sync-save`,disabled:o,children:`保存`})]})]})})}function Ap({config:e,reload:t}){let[n,r]=(0,R.useState)(e.publicServerUrl),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(``);return(0,R.useEffect)(()=>r(e.publicServerUrl),[e.publicServerUrl]),(0,U.jsxs)(`form`,{className:`settings-section stack`,onSubmit:async r=>{r.preventDefault(),a(!0),s(``);try{let r=await V(`site/config`,Qc,{method:`PATCH`,body:{expectedRevision:e.revision,publicServerUrl:n}});r.publicServerUrl===p()?t():location.assign(r.publicServerUrl.replace(/\/$/,``)+`/site-settings`)}catch(e){s(H(e))}finally{a(!1)}},children:[(0,U.jsx)(`h2`,{children:`访问地址`}),(0,U.jsx)(Z,{id:`site-server-url`,label:`服务外部地址`,hint:`包含路径前缀,用于客户端连接、资料链接和 Webhook。`,children:(0,U.jsx)(`input`,{"data-testid":`site-server-url`,required:!0,type:`url`,value:n,onChange:e=>r(e.target.value)})}),(0,U.jsx)(X,{error:!0,children:o}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{className:`primary`,disabled:i,children:`保存地址`})})]})}var jp=e=>V(`users`,I({users:F(el)}),{signal:e});function Mp({me:e}){let t=W(jp),[n,r]=(0,R.useState)();return(0,U.jsxs)(`div`,{className:`settings-section stack`,children:[(0,U.jsx)(bd,{title:`用户信息`,children:(0,U.jsxs)(`button`,{"data-testid":`user-add`,onClick:()=>r({kind:`add`}),children:[(0,U.jsx)(Od,{name:`plus`}),`新增用户`]})}),(0,U.jsx)(`p`,{className:`muted`,children:`建立账号后,在项目设置中添加该用户。`}),(0,U.jsx)(X,{error:!0,children:t.error}),t.error&&(0,U.jsx)(`button`,{onClick:()=>void t.reload(),children:`重试`}),(0,U.jsx)(`div`,{className:`member-list`,children:t.data?.users.map(t=>(0,U.jsxs)(`article`,{className:`member-card`,"data-testid":`user-card`,"data-user-id":t.id,children:[(0,U.jsxs)(`div`,{className:`member-heading`,children:[(0,U.jsx)(_d,{name:t.displayName}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{children:t.displayName}),(0,U.jsxs)(`small`,{children:[t.id,!t.enabled&&` · 已停用`]})]})]}),(0,U.jsxs)(`div`,{className:`member-actions`,children:[(0,U.jsx)(kd,{icon:`edit`,label:`修改显示名称`,"data-testid":`user-edit`,onClick:()=>r({kind:`edit`,user:t})}),t.id!==e&&(0,U.jsx)(kd,{icon:t.enabled?`disable`:`enable`,label:t.enabled?`停用账号`:`启用账号`,"data-testid":`user-toggle`,onClick:()=>r({kind:`toggle`,user:t})})]})]},t.id))}),n&&(0,U.jsx)(Np,{action:n,onClose:()=>r(void 0),onSaved:async()=>{r(void 0),await t.reload()}})]})}function Np({action:e,onClose:t,onSaved:n}){let[r,i]=(0,R.useState)(``),[a,o]=(0,R.useState)(e.kind===`add`?``:e.user.displayName),[s,c]=(0,R.useState)(!1),[l,u]=(0,R.useState)(``),d=e.kind===`add`?`新增用户`:e.kind===`edit`?`修改显示名称`:e.user.enabled?`停用账号`:`启用账号`;return(0,U.jsx)(Cd,{id:`user-dialog`,title:d,onClose:s?()=>{}:t,children:(0,U.jsxs)(`form`,{className:`stack`,"data-testid":`user-form`,"aria-label":d,"aria-busy":s,onSubmit:async t=>{t.preventDefault(),c(!0),u(``);try{e.kind===`add`?await V(`users`,el,{method:`POST`,body:tl.parse({id:r.trim(),displayName:a})}):await V(`users/${encodeURIComponent(e.user.id)}`,el,{method:`PATCH`,body:nl.parse({expectedRevision:e.user.revision,...e.kind===`edit`?{displayName:a}:{enabled:!e.user.enabled}})}),await n()}catch(e){u(H(e))}finally{c(!1)}},children:[e.kind===`add`&&(0,U.jsx)(Z,{id:`user-id`,label:`用户 ID`,hint:B.idHint,children:(0,U.jsx)(`input`,{required:!0,autoFocus:!0,autoComplete:`off`,maxLength:64,pattern:`[a-z][a-z0-9_\\-]{0,63}`,value:r,disabled:s,onChange:e=>i(e.target.value)})}),e.kind===`toggle`?(0,U.jsx)(`p`,{children:e.user.enabled?`停用 ${e.user.id} 后,该用户无法登录或同步任何项目,历史资料会保留。`:`恢复 ${e.user.id} 的登录权限;客户端需要重新接入。`}):(0,U.jsx)(Z,{id:`user-display-name`,label:B.displayName,children:(0,U.jsx)(`input`,{autoFocus:e.kind===`edit`,maxLength:120,value:a,disabled:s,onChange:e=>o(e.target.value)})}),(0,U.jsx)(X,{error:!0,children:l}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{type:`button`,disabled:s,onClick:t,children:B.cancel}),(0,U.jsx)(`button`,{className:`primary`,"data-testid":`user-submit`,disabled:s,children:s?B.saving:B.confirm})]})]})})}function Pp({session:e}){let t=W(op),n=W(ol.server),[r,i]=(0,R.useState)(`general`),[a,o]=(0,R.useState)(0),s=()=>o(e=>e+1),c=()=>{t.reload(),s()};return(0,U.jsxs)(`div`,{className:`site-settings`,children:[(0,U.jsx)(Sd,{title:`设置`}),(0,U.jsx)(gf,{prefix:`site`,orientation:`horizontal`,selected:r,onSelect:i,tabs:[{id:`general`,title:`通用`,icon:`general`},{id:`models`,title:`接入点`,icon:`model`},...e.siteRole===`admin`?[{id:`users`,title:`用户`,icon:`members`},{id:`wecom`,title:`企业微信`,icon:`message`}]:[]]}),(0,U.jsxs)(`div`,{className:`site-settings-content`,children:[e.siteRole===`admin`&&(0,U.jsx)(`section`,{id:`site-panel-wecom`,role:`tabpanel`,"aria-labelledby":`site-tab-wecom`,hidden:r!==`wecom`,children:r===`wecom`&&(0,U.jsx)(_p,{})}),(0,U.jsxs)(`section`,{id:`site-panel-general`,role:`tabpanel`,"aria-labelledby":`site-tab-general`,hidden:r!==`general`,children:[e.siteRole===`admin`?(0,U.jsx)(Op,{}):(0,U.jsx)(`p`,{className:`settings-section muted`,children:`全局同步策略由站点管理员维护。`}),(0,U.jsx)($f,{}),(0,U.jsxs)(`div`,{className:`settings-section`,children:[(0,U.jsx)(`h2`,{children:`服务端版本`}),(0,U.jsx)(X,{error:!0,children:n.error}),(0,U.jsx)(`p`,{"data-testid":`server-version`,children:n.data?.version??`—`})]})]}),(0,U.jsxs)(`section`,{id:`site-panel-models`,role:`tabpanel`,"aria-labelledby":`site-tab-models`,hidden:r!==`models`,children:[(0,U.jsx)(`div`,{className:`settings-section-actions`,children:(0,U.jsx)(kd,{icon:`refresh`,label:`刷新模型设置`,onClick:c})}),(0,U.jsx)(wp,{admin:e.siteRole===`admin`,profiles:t.data?.profiles,error:t.error,reload:c}),(0,U.jsxs)(`section`,{className:`settings-section stack`,"aria-label":`默认接入点`,children:[(0,U.jsx)(`h2`,{children:`默认接入点`}),(0,U.jsx)(X,{error:!0,children:t.error}),t.data&&(0,U.jsx)(U.Fragment,{children:(0,U.jsx)(sp,{title:`全站默认`,profiles:t.data?.profiles??[],admin:e.siteRole===`admin`,generation:a,onChanged:s})})]})]}),e.siteRole===`admin`&&(0,U.jsx)(`section`,{id:`site-panel-users`,role:`tabpanel`,"aria-labelledby":`site-tab-users`,hidden:r!==`users`,children:r===`users`&&(0,U.jsx)(Mp,{me:e.memberId})})]})]})}var Fp=`modulepreload`,Ip=function(e,t){return new URL(e,t).href},Lp={},Rp=function(e){return e.pathname.endsWith(`.css`)},zp=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Bp=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Ip(t,n);let r=s(t),i=Rp(r);return zp(Lp,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Fp,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Vp=(0,R.lazy)(()=>Bp(()=>import(`./Materials-DK3CkLr0.js`).then(e=>({default:e.Materials})),__vite__mapDeps([0,1,2,3]),import.meta.url)),Hp=(0,R.lazy)(()=>Bp(()=>import(`./Files-BvCYgjVV.js`).then(e=>({default:e.Files})),__vite__mapDeps([4,1,5,6,2]),import.meta.url)),Up=(0,R.lazy)(()=>Bp(()=>import(`./Assistant-BeYamS0w.js`).then(e=>({default:e.Assistant})),__vite__mapDeps([7,1,8]),import.meta.url)),Wp=(0,R.lazy)(()=>Bp(()=>import(`./Dashboard-BzmrE4Xv.js`).then(e=>({default:e.Dashboard})),__vite__mapDeps([9,5,6,10]),import.meta.url)),Gp=(0,R.lazy)(()=>Bp(()=>import(`./Sessions-D_579m-e.js`).then(e=>({default:e.Sessions})),__vite__mapDeps([11,1,5,2,12]),import.meta.url));function Kp(){let[e,t]=(0,R.useState)(),[n,r]=(0,R.useState)(),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(0);return(0,R.useEffect)(()=>{let e=new AbortController;return a(``),(async()=>{try{let n=await ol.setup(e.signal),i;if(n.initialized)try{i=await ol.session(e.signal)}catch(e){if(!(e instanceof il&&e.status===401))throw e}e.signal.aborted||(t(i),r(n.initialized))}catch(t){e.signal.aborted||a(H(t))}})(),()=>e.abort()},[o]),(0,R.useEffect)(()=>{let e=()=>t(void 0);return window.addEventListener(`teammy:logout`,e),()=>window.removeEventListener(`teammy:logout`,e)},[]),i?(0,U.jsxs)(`main`,{className:`boot`,children:[(0,U.jsx)(hd,{}),(0,U.jsx)(X,{error:!0,children:i}),(0,U.jsx)(`button`,{onClick:()=>s(e=>e+1),children:B.retry})]}):n===void 0?(0,U.jsxs)(`main`,{className:`boot`,children:[(0,U.jsx)(hd,{}),(0,U.jsx)(`p`,{role:`status`,children:B.loading})]}):n?e?f()===`/connect`?(0,U.jsx)(df,{session:e,onLogout:()=>t(void 0)}):(0,U.jsx)(hl,{children:(0,U.jsx)(Jp,{session:e,onLogout:()=>t(void 0)})},e.memberId):(0,U.jsx)(nf,{onLogin:t}):(0,U.jsx)(sf,{onDone:e=>{history.replaceState(null,``,d(`/projects`)),r(!0),t(e)}})}function qp(){let e=f().match(/^\/projects\/([a-z][a-z0-9_-]{0,63})\/(dashboard|assistant|files|materials|sessions|members|settings)$/);if(e)return{projectId:e[1],page:e[2]};let t=f()===`/account`?`site-settings`:f().slice(1);return{projectId:``,page:[`projects`,`site-settings`,`members`,...Ef].includes(t)?t:f()===`/ai`?`dashboard`:`projects`}}function Jp({session:e,onLogout:t}){let n=W(ol.projects,!0),[r,i]=(0,R.useState)(qp),a=(0,R.useCallback)((e,t=!1)=>{t?history.replaceState(null,``,d(e)):history.pushState(null,``,d(e)),i(qp()),document.querySelector(`main`)?.focus()},[]);(0,R.useEffect)(()=>{let e=()=>{i(qp())};return window.addEventListener(`popstate`,e),()=>{window.removeEventListener(`popstate`,e)}},[]);let o=n.data?.projects;(0,R.useEffect)(()=>{if(r.page===`members`&&r.projectId){a(Df(r.projectId,`settings`)+`?tab=members`,!0);return}if(r.projectId||!Ef.includes(r.page)&&r.page!==`members`||!o)return;let t=``;try{t=localStorage.getItem(`teammy-project:${e.memberId}`)??``}catch{}let n=o.find(e=>e.projectId===t)??o[0];a(n?Df(n.projectId,r.page===`members`?`settings`:r.page)+(r.page===`members`?`?tab=members`:``):`/projects`,!0)},[r.projectId,r.page,o,a,e.memberId]);let s=o?.find(e=>e.projectId===r.projectId);(0,R.useEffect)(()=>(document.title=s?`${s.projectName} | Teammy 工作台`:`Teammy 工作台`,()=>{document.title=`Teammy 工作台`}),[s?.projectName]),(0,R.useEffect)(()=>{if(s)try{localStorage.setItem(`teammy-project:${e.memberId}`,s.projectId)}catch{}},[s?.projectId,e.memberId]);let c=(0,R.useMemo)(()=>r.projectId?_f(r.projectId):null,[r.projectId]),l=r.page===`projects`||r.page===`site-settings`;return(0,U.jsxs)(`div`,{className:`workspace ${l?`workspace-home`:``}`,children:[(0,U.jsx)(`a`,{className:`skip-link`,href:`#main`,children:B.skipToMain}),!l&&(0,U.jsx)(kf,{projectId:r.projectId,page:r.page,navigate:a}),(0,U.jsx)(`div`,{className:`main-shell`,children:(0,U.jsxs)(`main`,{id:`main`,"data-testid":`workspace-main`,"data-page":r.page,"data-project-id":r.projectId||void 0,tabIndex:-1,children:[(0,U.jsx)(X,{error:!0,children:n.error}),l?(0,U.jsx)(jf,{session:e,navigate:a,onLogout:t,routeKey:r.page,children:r.page===`site-settings`?(0,U.jsx)(Pp,{session:e}):(0,U.jsx)(Sp,{projects:o??[],session:e,reload:n.reload,onOpen:e=>a(Df(e,`dashboard`))})}):c&&s?(0,U.jsx)(vf.Provider,{value:c,children:(0,U.jsx)(Yp,{page:r.page,onLeave:async()=>{await n.reload(),a(`/projects`,!0)}})},r.projectId):o?(0,U.jsx)(X,{error:!0,children:`项目不存在或你已不再是该项目成员。请从项目列表重新选择。`}):(0,U.jsx)(`p`,{role:`status`,children:B.loading})]})})]})}function Yp({page:e,onLeave:t}){let n=yf(),r=W((0,R.useCallback)(async e=>{let[t,r,i]=await Promise.all([n.api.config(e),n.api.members(e),n.request(`identity`,Jc,{signal:e})]);return{config:t,members:r.members,session:i}},[n]),!0),i=r.data;return r.error?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(X,{error:!0,children:r.error}),(0,U.jsx)(`button`,{onClick:()=>void r.reload(),children:`重试`})]}):i?(0,U.jsx)(R.Suspense,{fallback:(0,U.jsx)(`p`,{role:`status`,children:B.loading}),children:e===`files`?(0,U.jsx)(Hp,{members:i.members,me:i.session.memberId,onRefresh:()=>void r.reload()}):e===`dashboard`?(0,U.jsx)(Wp,{members:i.members,config:i.config}):e===`materials`?(0,U.jsx)(Vp,{}):e===`sessions`?(0,U.jsx)(Gp,{members:i.members}):e===`assistant`?(0,U.jsx)(Up,{me:i.session.memberId}):(0,U.jsx)(xp,{config:i.config,session:i.session,reload:()=>void r.reload(),members:i.members,onLeave:t,initialTab:new URLSearchParams(location.search).get(`tab`)??void 0})}):(0,U.jsx)(`p`,{role:`status`,children:B.loading})}(0,Tc.createRoot)(document.getElementById(`root`)).render((0,U.jsx)(Kp,{}));export{h as $,fl as A,z as B,Sd as C,W as D,vl as E,B as F,tc as G,L as H,Nc as I,M as J,N as K,Mc as L,H as M,ll as N,_l as O,rl as P,k as Q,Ac as R,X as S,Td as T,F as U,Ls as V,P as W,xs as X,Js as Y,ys as Z,Z as _,Xf as a,gd as b,Lf as c,mf as d,d as et,pf as f,yd as g,vd as h,Gf as i,il as j,gl as k,Nf as l,Nd as m,Jf as n,s as nt,Yf as o,Pd as p,I as q,Kf as r,l as rt,Pf as s,qf as t,o as tt,yf as u,Od as v,xd as w,Cd as x,kd as y,jc as z};
|
|
66
|
+
`).map(e=>e.trim()).filter(Boolean)}}),await n()}catch(e){d(H(e))}finally{l(!1)}},children:[(0,U.jsxs)(`fieldset`,{disabled:c,className:`stack`,children:[(0,U.jsx)(Z,{id:`shared-files-maintainer`,label:`维护成员`,children:(0,U.jsxs)(`select`,{value:i,onChange:e=>a(e.target.value),children:[(0,U.jsx)(`option`,{value:``,children:`暂停发布`}),t.map(e=>(0,U.jsx)(`option`,{value:e.id,disabled:!e.enabled||!e.accountEnabled,children:e.displayName||e.id},e.id))]})}),(0,U.jsx)(Z,{id:`shared-files-paths`,label:`公共资料路径`,hint:`每行一个根目录文件或以下划线开头的文件夹;例如 README.md、_template/。由维护成员更新,其他成员自动接收。`,children:(0,U.jsx)(`textarea`,{rows:3,value:o,onChange:e=>s(e.target.value)})})]}),(0,U.jsx)(X,{error:!0,children:u}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{className:`primary`,disabled:c,children:`保存公共资料设置`})})]})}I({text:M().trim().min(1),requestId:M().min(1).optional()}).strict(),I({body:M().trim().min(1),requestId:M().min(1).optional()}).strict(),I({to:Js([tc(`debug`),F(z).min(1)]),body:M().trim().min(1),branch:M().trim().min(1).optional()}).strict();var Bf=N().int().positive().nullable(),$=L([`github`,`gongfeng`]),Vf={github:`https://api.github.com`,gongfeng:`https://git.tencent.com/api/v3`},Hf=I({provider:$.default(`github`),repositoryUrl:M().trim().default(``),repository:M().trim().default(``),apiUrl:M().url().optional(),githubApiUrl:M().url().optional(),debugRecipient:z.nullable().default(null),contextWindow:N().int().positive().default(256e3),compactAt:N().int().positive().default(22e4),fetchIntervalSeconds:Bf.default(300),idleSeconds:Bf.default(1800),restartSeconds:Bf.default(86400)}).strict().refine(e=>e.compactAt<e.contextWindow,`压缩阈值应小于模型上下文窗口。`).transform(({githubApiUrl:e,apiUrl:t,...n})=>({...n,apiUrl:(t??e??Vf[n.provider]).replace(/\/+$/,``)}));I({config:Hf,token:M().nullable().optional(),webhookSecret:M().nullable().optional(),sshPrivateKey:M().nullable().optional(),sshKnownHosts:M().nullable().optional()}).strict();var Uf=I({config:Hf,tokenConfigured:P(),webhookConfigured:P(),sshConfigured:P(),sshPublicKey:M().nullable().optional(),webhookUrl:M().optional()}),Wf=I({id:M(),name:M(),url:M()}),Gf=I({id:M(),text:M(),answer:M(),author:M().nullable().optional(),source:tc(`wecom`).optional(),state:L([`queued`,`running`,`succeeded`,`failed`]),error:M().nullable(),createdAt:M()}),Kf=I({id:M(),seq:N(),runId:M().nullable(),role:L([`user`,`assistant`]),author:M(),body:M(),state:Gf.shape.state,source:M().nullable(),createdAt:M()}),qf=I({chats:F(I({id:M(),title:M(),kind:L([`matter`,`notice`]).optional(),status:L([`active`,`waiting`,`completed`]).optional(),unread:P().optional(),createdAt:M(),updatedAt:M(),state:Gf.shape.state.nullable()}))}),Jf=I({id:M(),title:M().optional(),runs:F(Gf),messages:F(Kf),readCursor:N(),redirect:M().nullable().optional(),kind:L([`matter`,`notice`]).optional(),status:L([`active`,`waiting`,`completed`]).optional(),pending:I({members:F(M()),question:M()}).nullable().optional(),hold:I({scope:L([`all`,`writes`]),reason:M()}).passthrough().nullable().optional(),participants:F(M()).optional(),visibility:L([`project`,`participants`]).optional(),cursor:N()}),Yf=I({id:M(),body:M(),box:L([`normal`,`debug`]),taskId:N().nullable(),createdAt:M(),readAt:M().nullable(),archivedAt:M().nullable(),conversationId:M().nullable(),recipients:F(I({userId:M()}))}),Xf=I({messages:F(Yf),unread:N()}),Zf=e=>V(`site/worker-status`,Yd,{signal:e}),Qf=()=>W(Zf,5e3);function $f(){let e=Qf(),t=e.data;return(0,U.jsxs)(`div`,{className:`settings-section`,children:[(0,U.jsx)(`h2`,{children:`后台服务`}),(0,U.jsx)(X,{error:!0,children:e.error}),(0,U.jsx)(`p`,{role:`status`,"data-testid":`worker-status`,children:t?{online:`运行中`,offline:`暂未响应`,unknown:`未检测到后台服务`}[t.state]:`正在读取…`}),t?.lastSeenAt&&t.state!==`online`&&(0,U.jsxs)(`p`,{className:`muted`,children:[`最近响应:`,new Date(t.lastSeenAt).toLocaleString()]}),t&&t.state!==`online`&&(0,U.jsx)(`p`,{className:`muted`,children:`请检查部署中的 ai-worker 是否已启动。`})]})}function ep({generation:e}){let{request:t}=yf(),n=W((0,R.useCallback)(e=>t(`agents/repository/status`,Xd,{signal:e}),[t,e]),5e3),r=n.data,i=r&&[`pending`,`cloning`,`fetching`].includes(r.state),a=r&&[`failed`,`interrupted`].includes(r.state);return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(X,{error:!0,children:n.error}),(0,U.jsxs)(`div`,{className:`repository-status-card${i?` active`:``}${a?` error`:``}`,role:`status`,children:[(0,U.jsx)(Od,{name:a?`attention`:r?.state===`ready`?`check`:`download`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{"data-testid":`repository-status`,children:r?{unconfigured:`尚未配置仓库`,pending:`等待后台下载仓库`,cloning:`正在下载仓库`,fetching:`正在拉取远端更新`,ready:`仓库已下载`,failed:`仓库下载失败`,interrupted:`仓库下载已中断`}[r.state]:`正在读取仓库状态…`}),i&&(0,U.jsx)(`p`,{children:`包含默认启用的子模块,可离开此页,后台会继续处理。`}),r?.state===`failed`&&(0,U.jsx)(`p`,{children:`请查看诊断日志,确认主仓库及子模块的访问权限与网络连接。`}),r?.state===`interrupted`&&(0,U.jsx)(`p`,{children:`等待后台重试。`}),r?.lastSuccessAt&&(0,U.jsxs)(`p`,{children:[`最近完成:`,new Date(r.lastSuccessAt).toLocaleString()]})]})]})]})}function tp({members:e}){let{request:t,projectId:n}=yf(),r=W((0,R.useCallback)(e=>t(`agents/settings`,Uf,{signal:e}),[t])),[i,a]=(0,R.useState)(0),[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(()=>Hf.parse({})),[u,d]=(0,R.useState)(``),[f,m]=(0,R.useState)(``),[h,g]=(0,R.useState)(``),[_,v]=(0,R.useState)(``),[y,b]=(0,R.useState)(!1),[ee,te]=(0,R.useState)(``),[ne,re]=(0,R.useState)(!1),[x,ie]=(0,R.useState)(``);(0,R.useEffect)(()=>{r.data&&(l(r.data.config),s(r.data.sshPublicKey??null))},[r.data]),(0,R.useEffect)(()=>{if(!r.data||r.data.config.repositoryUrl)return;let e=new AbortController;return V(`setup/options`,$d,{signal:e.signal}).then(e=>{!e.repositoryUrl||e.initialProjectId&&e.initialProjectId!==n||l(t=>{if(t.repositoryUrl)return t;let n=e.repositoryUrl,r=n.includes(`git.tencent.com`)?`gongfeng`:t.provider,i=n.replace(/^[^@]+@[^:]+:/,``).replace(/^https?:\/\/[^/]+\//,``).replace(/\.git$/,``);return{...t,repositoryUrl:n,repository:i,provider:r,apiUrl:Vf[r]}})}).catch(()=>{}),()=>e.abort()},[!!r.data,n]);async function S(e,n=!1){e?.preventDefault(),b(!0),te(``),re(!1),ie(``);try{await t(`agents/settings`,Uf,{method:`PUT`,body:{config:c,...u?{token:u}:{},...f?{webhookSecret:f}:{},...h?{sshPrivateKey:h}:{},..._?{sshKnownHosts:_}:{}}}),d(``),m(``),g(``),v(``),await r.reload(),a(e=>e+1),re(!0),n&&(await t(`agents/repository/transport-check`,I({ok:P()}),{method:`POST`,timeoutMs:305e3}),ie(`远端连接检查通过。完整下载及子模块状态见上方,工作区将在下载完成后导入。`))}catch(e){te(H(e))}finally{b(!1)}}return(0,U.jsx)(`div`,{className:`settings-section`,children:(0,U.jsxs)(`form`,{className:`stack`,onSubmit:e=>void S(e),"data-testid":`project-agent-settings`,children:[(0,U.jsxs)(`fieldset`,{className:`stack`,disabled:y||r.loading,children:[(0,U.jsx)(`h2`,{children:`仓库连接`}),(0,U.jsx)(ep,{generation:i}),(0,U.jsx)(`p`,{className:`muted`,children:`请配置仓库连接、访问密钥及 PR/MR 评论账号;评论可使用管理员账号。`}),(0,U.jsx)(Z,{id:`agent-provider`,label:`Git 平台`,children:(0,U.jsxs)(`select`,{value:c.provider,onChange:e=>{let t=e.target.value;l({...c,provider:t,apiUrl:Vf[t]}),ie(``)},children:[(0,U.jsx)(`option`,{value:`github`,children:`GitHub`}),(0,U.jsx)(`option`,{value:`gongfeng`,children:`工蜂`})]})}),(0,U.jsx)(Z,{id:`agent-repository-url`,label:`仓库地址`,children:(0,U.jsx)(`input`,{value:c.repositoryUrl,placeholder:c.provider===`gongfeng`?`https://git.tencent.com/group/repository.git`:`https://github.com/owner/repository.git`,onChange:e=>l({...c,repositoryUrl:e.target.value}),onBlur:()=>{if(!c.repository){let e=``;try{e=new URL(c.repositoryUrl).pathname}catch{e=c.repositoryUrl.match(/^[^@]+@[^:]+:(.+)$/)?.[1]??``}e&&l({...c,repository:e.replace(/^\/+|\/+$/g,``).replace(/\.git$/,``)})}}})}),(0,U.jsx)(Z,{id:`agent-repository`,label:c.provider===`gongfeng`?`工蜂仓库`:`GitHub 仓库`,children:(0,U.jsx)(`input`,{value:c.repository,placeholder:c.provider===`gongfeng`?`group/repository 或项目 ID`:`owner/repository`,onChange:e=>l({...c,repository:e.target.value})})}),(0,U.jsx)(Z,{id:`agent-api-url`,label:`API 地址`,children:(0,U.jsx)(`input`,{type:`url`,value:c.apiUrl,onChange:e=>l({...c,apiUrl:e.target.value})})}),(0,U.jsx)(Z,{id:`agent-token`,label:`访问与评论令牌`,hint:c.provider===`gongfeng`?`使用具有 api 权限的个人访问令牌;HTTPS 拉取还需 read_repository 权限。`:`令牌需具备仓库读取和发表评论权限。`,children:(0,U.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:u,placeholder:r.data?.tokenConfigured?`已配置;留空保持现状`:``,onChange:e=>d(e.target.value)})}),(0,U.jsx)(Z,{id:`agent-debug-recipient`,label:`运行提醒收件人`,children:(0,U.jsxs)(`select`,{value:c.debugRecipient??``,onChange:e=>l({...c,debugRecipient:e.target.value||null}),children:[(0,U.jsx)(`option`,{value:``,children:`管理员`}),e.filter(e=>e.enabled&&e.accountEnabled).map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.displayName||e.id},e.id))]})}),(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{children:`PR/MR 事件接入`}),(0,U.jsxs)(`div`,{className:`stack`,children:[(0,U.jsx)(wd,{id:`agent-webhook-url`,label:`Webhook 地址`,value:r.data?.webhookUrl??`${p()}/api/v1/projects/${encodeURIComponent(n)}/agents/${c.provider}/events`}),(0,U.jsx)(Z,{id:`agent-webhook-secret`,label:`Webhook Secret`,children:(0,U.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:f,placeholder:r.data?.webhookConfigured?`已配置;留空保持现状`:``,onChange:e=>m(e.target.value)})}),(0,U.jsx)(`p`,{className:`muted`,children:c.provider===`gongfeng`?`订阅合并请求、评论和评审事件,填写相同秘密令牌,并在工蜂中测试、激活 Webhook。建议先保存并检查仓库。`:`在仓库中使用 JSON webhook,订阅 Pull requests、Issue comments、Pull request reviews 和 Pull request review comments。`})]})]}),(0,U.jsxs)(`section`,{className:`stack`,children:[(0,U.jsx)(`h3`,{children:`项目 SSH 公钥`}),o&&(0,U.jsx)(wd,{id:`agent-ssh-public-key`,label:c.provider===`gongfeng`?`复制到工蜂账号的 SSH 密钥中`:`复制到 GitHub 仓库的 Deploy keys 中`,value:o}),!o&&(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{type:`button`,"data-testid":`agent-generate-key`,disabled:y,onClick:async()=>{b(!0),te(``);try{let e=await t(`agents/repository/ssh-key`,Uf,{method:`POST`});s(e.sshPublicKey??null)}catch(e){te(H(e))}finally{b(!1)}},children:`生成项目公钥`})}),(0,U.jsxs)(`small`,{children:[c.provider===`gongfeng`?`使用 SSH 仓库地址时,将公钥添加到工蜂的「个人设置 → SSH 密钥」,访问权限继承该账号。`:`使用 SSH 仓库地址时,将公钥添加到 GitHub 仓库的「Settings → Deploy keys」。`,`首次连接记录主机公钥,后续变化会拒绝连接。`]})]}),(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{children:`已有 SSH 凭据`}),(0,U.jsxs)(`div`,{className:`stack`,children:[(0,U.jsx)(Z,{id:`agent-ssh-key`,label:`SSH 私钥`,children:(0,U.jsx)(`textarea`,{rows:3,value:h,placeholder:r.data?.sshConfigured?`已配置;留空保持现状`:``,onChange:e=>g(e.target.value)})}),(0,U.jsx)(Z,{id:`agent-ssh-hosts`,label:`已确认的服务器公钥(known_hosts)`,children:(0,U.jsx)(`textarea`,{rows:2,value:_,onChange:e=>v(e.target.value)})})]})]}),(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{children:`运行设置`}),(0,U.jsxs)(`div`,{className:`form-grid`,children:[(0,U.jsx)(Z,{id:`agent-context-window`,label:`模型上下文窗口(tokens)`,children:(0,U.jsx)(`input`,{type:`number`,value:c.contextWindow,onChange:e=>l({...c,contextWindow:Number(e.target.value)})})}),(0,U.jsx)(Z,{id:`agent-compact-at`,label:`提前压缩位置(tokens)`,children:(0,U.jsx)(`input`,{type:`number`,value:c.compactAt,onChange:e=>l({...c,compactAt:Number(e.target.value)})})}),[[`fetchIntervalSeconds`,`仓库 fetch 间隔(秒)`],[`idleSeconds`,`额外 Pi 进程空闲回收(秒)`],[`restartSeconds`,`空闲时重建沙箱的周期(秒)`]].map(([e,t])=>(0,U.jsx)(Z,{id:`agent-${e}`,label:t,hint:`留空关闭;不打断正在执行的回答。`,children:(0,U.jsx)(`input`,{type:`number`,value:c[e]??``,onChange:t=>l({...c,[e]:t.target.value?Number(t.target.value):null})})},e))]})]})]}),(0,U.jsx)(X,{error:!0,children:ee||r.error}),(0,U.jsx)(X,{children:x||(ne?`已保存。`:null)}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{className:`primary`,disabled:y||r.loading,children:`保存`}),(0,U.jsx)(`button`,{type:`button`,disabled:y||r.loading||!c.repositoryUrl,onClick:()=>void S(void 0,!0),children:`保存并检查仓库`}),(0,U.jsx)(`button`,{type:`button`,disabled:y||!c.repository,onClick:async()=>{b(!0),te(``),ie(``);try{let e=await t(`agents/repository/check`,Wf,{method:`POST`,timeoutMs:305e3});ie(`工蜂 / GitHub API 可读:${e.name}。`)}catch(e){te(H(e))}finally{b(!1)}},children:`检查已保存的 API 配置`})]})]})})}var np=Xs(`kind`,[I({kind:tc(`repository`),path:M().trim().min(1)}).strict(),I({kind:tc(`directory`),path:M().trim().min(1)}).strict()]),rp=I({members:F(M()),fileCount:N().int().nonnegative(),preserved:F(M()),skipped:F(M())}),ip=I({state:L([`none`,`pending`,`running`,`succeeded`,`failed`]),source:np.nullable(),result:rp.nullable(),error:M().nullable()});function ap({onImported:e}){let{request:t}=yf(),n=W((0,R.useCallback)(e=>t(`project/workspace-import`,ip,{signal:e}),[t]),5e3),r=Qf(),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(``),u=n.data,d=u?.state===`succeeded`?JSON.stringify(u):null,f=(0,R.useRef)(null);(0,R.useEffect)(()=>{let t=f.current!==d;f.current=d,d&&t&&e()},[d,e]),(0,R.useEffect)(()=>{u?.source?.kind===`directory`&&a(u.source.path)},[u?.source?.kind,u?.source?.path]);async function p(e=!1){s(!0),l(``);try{await t(`project/workspace-import`,ip,{method:`POST`,body:e?u?.source:{kind:`directory`,path:i.trim()}}),await n.reload()}catch(e){l(H(e))}finally{s(!1)}}let m=u?.state===`pending`||u?.state===`running`;return(0,U.jsxs)(`div`,{className:`settings-section`,"data-testid":`workspace-import-settings`,children:[(0,U.jsx)(`h2`,{children:`工作区初始化`}),(0,U.jsx)(`p`,{className:`muted`,children:`连接仓库后自动导入其中的 workspaces,也可从服务器目录导入。原文件和已有同步版本保留。`}),u?.state!==`none`&&u&&(0,U.jsxs)(`div`,{role:`status`,"data-testid":`workspace-import-status`,children:[u.state===`pending`&&`等待后台导入`,u.state===`running`&&(r.data?.state===`online`?`正在导入工作区`:`等待后台继续导入`),u.state===`succeeded`&&`已识别 ${u.result?.members.length??0} 位成员,导入 ${u.result?.fileCount??0} 个文件。`,u.source&&(0,U.jsx)(`p`,{className:`muted`,children:u.source.path}),!!u.result?.preserved.length&&(0,U.jsxs)(`p`,{className:`muted`,children:[`保留已有版本:`,u.result.preserved.map(e=>e===`_project`?`公共资料`:e).join(`、`)]}),!!u.result?.skipped.length&&(0,U.jsxs)(`p`,{className:`muted`,children:[`未纳入同步范围:`,u.result.skipped.join(`、`)]})]}),m&&r.data&&r.data.state!==`online`&&(0,U.jsx)(`p`,{className:`muted`,children:`后台服务暂未响应,请检查 ai-worker 是否已启动。`}),(0,U.jsx)(X,{error:!0,children:u?.error||n.error||c}),u?.state===`failed`&&(0,U.jsx)(`button`,{disabled:o,onClick:()=>void p(!0),children:`重试导入`}),(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{children:`从服务器目录导入`}),(0,U.jsxs)(`form`,{className:`stack`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,U.jsx)(Z,{id:`import-workspace-path`,label:`工作区路径`,hint:`容器部署时填写只读挂载后的路径,例如 /imports/utu/workspaces。`,children:(0,U.jsx)(`input`,{required:!0,value:i,placeholder:`/imports/utu/workspaces`,disabled:o||m,onChange:e=>a(e.target.value)})}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{disabled:o||m||!i.trim(),children:`导入工作区`})})]})]})]})}var op=e=>V(`ai/profiles`,Rd,{signal:e});function sp({projectId:e,title:t,profiles:n,admin:r,generation:i,onChanged:a}){let o=e?`projects/${encodeURIComponent(e)}/ai/default`:`ai/default`,s=W((0,R.useCallback)(e=>V(o,zd,{signal:e}),[o,i]));return(0,U.jsxs)(`div`,{className:`model-default-row`,"data-testid":`ai-default-row`,"data-scope":e??`site`,children:[(0,U.jsx)(X,{error:!0,children:s.error}),s.data?(0,U.jsx)(cp,{value:s.data,path:o,id:e??`site`,title:t,profiles:n,admin:r,onChanged:()=>{s.reload(),a()},reload:()=>void s.reload()},`${s.data.revision}/${s.data.effectiveProfileId}/${s.data.available}`):(0,U.jsx)(`span`,{role:`status`,children:`正在加载…`}),s.error&&(0,U.jsx)(`button`,{onClick:()=>void s.reload(),children:`重试`})]})}function cp({value:e,path:t,id:n,title:r,profiles:i,admin:a,onChanged:o,reload:s}){let[c,l]=(0,R.useState)(e.profileId??``),[u,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(``),m=vl(),h=i.find(t=>t.id===e.effectiveProfileId);return(0,U.jsxs)(`form`,{"aria-label":`${r}默认接入点`,"aria-busy":u,onSubmit:async n=>{n.preventDefault(),d(!0),p(``);try{await V(t,zd,{method:`PUT`,signal:m,body:{expectedRevision:e.revision,profileId:c||null}}),o()}catch(e){m.aborted||p(H(e))}finally{d(!1)}},children:[(0,U.jsxs)(`div`,{className:`model-default-controls`,children:[(0,U.jsx)(Z,{id:`ai-default-${n}`,label:r,children:(0,U.jsxs)(`select`,{disabled:!a||u,value:c,onChange:e=>l(e.target.value),children:[(0,U.jsx)(`option`,{value:``,children:n===`site`?`未设置`:`继承全站默认${e.source===`site`&&h?` · ${h.name}`:``}`}),i.map(e=>(0,U.jsxs)(`option`,{value:e.id,disabled:!e.enabled,children:[e.name,e.enabled?``:`(已停用)`]},e.id))]})}),a&&(0,U.jsx)(kd,{icon:`check`,type:`submit`,label:`保存${r}默认接入点`,"data-testid":`ai-default-save`,disabled:u||c===(e.profileId??``)})]}),(0,U.jsx)(`p`,{className:`muted`,role:`status`,"data-testid":`ai-default-status-${n}`,children:e.available?`已配置 · ${h?.name??e.effectiveProfileId}`:e.effectiveProfileId?`接入点已停用`:`尚未配置默认接入点`}),!e.available&&e.effectiveProfileId&&(0,U.jsx)(X,{error:!0,children:`默认接入点已停用,请重新选择。`}),(0,U.jsx)(X,{error:!0,children:f}),f&&(0,U.jsx)(`button`,{type:`button`,onClick:s,disabled:u,children:`重新载入`})]})}function lp(){let{projectId:e}=yf(),t=W(op),[n,r]=(0,R.useState)(0);return(0,U.jsxs)(`section`,{className:`settings-section`,"aria-label":`模型接入`,children:[(0,U.jsx)(`h2`,{children:`模型接入`}),(0,U.jsx)(X,{error:!0,children:t.error}),t.data&&(0,U.jsx)(sp,{projectId:e,title:`项目默认`,profiles:t.data.profiles,admin:!0,generation:n,onChanged:()=>r(e=>e+1)})]})}I({enabled:P(),botId:M().trim().min(1),secret:M().trim().min(1).optional()}).strict();var up=I({enabled:P(),botId:M(),secretConfigured:P(),state:L([`disabled`,`connecting`,`connected`,`disconnected`,`error`]),error:M().nullable(),pending:N()}),dp=I({available:P(),bound:P(),subscribed:P(),activeProject:M().nullable(),pending:N(),error:M().nullable()}),fp=I({code:M(),expiresAt:N()}),pp=I({groups:F(I({id:M(),boundBy:M(),createdAt:M()}))}),mp=I({channels:F(I({id:M(),name:M()})),selected:M().nullable(),selectedName:M().nullable(),missingMentions:F(M()),refreshing:P(),updatedAt:N().nullable(),error:M().nullable(),pending:N()}),hp=e=>V(`site/wecom`,up,{signal:e}),gp={disabled:`未启用`,connecting:`连接中`,connected:`已连接`,disconnected:`未连接`,error:`连接异常`};function _p(){let e=W(hp,3e3),[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(``),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(``),[l,u]=(0,R.useState)(``),d=e.data,f=t??{botId:d?.botId??``,enabled:d?.enabled??!0};async function p(){o(!0),c(``),u(``);try{await V(`site/wecom`,up,{method:`PUT`,body:{...f,...r?{secret:r}:{}}}),i(``),n(null),await e.reload(),u(`已保存,连接状态会自动更新。`)}catch(e){c(H(e))}finally{o(!1)}}return(0,U.jsxs)(`div`,{className:`settings-section stack`,"data-testid":`wecom-site-settings`,children:[(0,U.jsx)(`h2`,{children:`企业微信机器人`}),(0,U.jsx)(`p`,{className:`muted`,children:`将Tim的消息转发到企业微信。原消息与回复仍保存在网页中。`}),(0,U.jsx)(X,{error:!0,children:e.error||s}),(0,U.jsxs)(`form`,{className:`stack`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,U.jsxs)(`fieldset`,{className:`stack`,disabled:a||!d,children:[(0,U.jsx)(Z,{id:`wecom-bot-id`,label:`Bot ID`,children:(0,U.jsx)(`input`,{required:!0,value:f.botId,onChange:e=>n({...f,botId:e.target.value})})}),(0,U.jsx)(Z,{id:`wecom-secret`,label:`Secret`,children:(0,U.jsx)(`input`,{type:`password`,autoComplete:`new-password`,required:!d?.secretConfigured||f.botId!==d.botId,value:r,placeholder:d?.secretConfigured?`已保存,留空保持不变`:`填写长连接专用 Secret`,onChange:e=>i(e.target.value)})}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{type:`button`,role:`switch`,"aria-label":`启用企业微信`,"aria-checked":f.enabled,className:f.enabled?`primary`:``,onClick:()=>n({...f,enabled:!f.enabled}),children:f.enabled?`已启用`:`已停用`})})]}),(0,U.jsx)(X,{children:l}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{className:`primary`,disabled:a||!d,children:a?`保存中…`:`保存`})})]}),(0,U.jsxs)(`p`,{role:`status`,children:[d?gp[d.state]:`加载中…`,d?.pending?` · ${d.pending} 条待转发`:``]}),(0,U.jsx)(X,{error:!0,children:d?.error??``}),(0,U.jsx)(`p`,{className:`muted`,children:`使用 API 模式的长连接机器人。保存后,成员可在项目设置中绑定账号。`})]})}function vp(){let{request:e}=yf(),t=W((0,R.useCallback)(t=>e(`wecom/channels`,mp,{signal:t}),[e]),3e3),[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(``),c=t.data,l=n??c?.selected??``;async function u(n){a(!0),s(``);try{await e(n?`wecom/channels/refresh`:`wecom/channels`,mp,{method:n?`POST`:`PUT`,...n?{}:{body:{topicId:l||null}}}),n||r(null),await t.reload()}catch(e){s(H(e))}finally{a(!1)}}return(0,U.jsxs)(`section`,{className:`stack`,"data-testid":`wecom-channel-settings`,children:[(0,U.jsx)(`h3`,{children:`项目频道`}),(0,U.jsx)(`p`,{className:`muted`,children:`每件事项独立成帖,按需 @ 相关成员,回复与网页同步。频道成员均可查看共享事项。`}),(0,U.jsx)(X,{error:!0,children:o||t.error||c?.error||``}),(0,U.jsx)(Z,{id:`wecom-channel`,label:`接收事项的频道`,children:(0,U.jsxs)(`select`,{value:l,disabled:i||!c,onChange:e=>r(e.target.value),children:[(0,U.jsx)(`option`,{value:``,children:`暂不连接频道`}),c?.selected&&!c.channels.some(e=>e.id===c.selected)&&(0,U.jsxs)(`option`,{value:c.selected,children:[c.selectedName,`(暂不可用)`]}),c?.channels.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{disabled:i||!c||c.refreshing,onClick:()=>void u(!0),children:c?.refreshing?`刷新中…`:`刷新`}),(0,U.jsx)(`button`,{className:`primary`,disabled:i||!c||l===(c.selected??``),onClick:()=>void u(!1),children:`保存`})]}),(0,U.jsx)(`p`,{className:`muted`,children:`机器人需允许获取所有内容、主动发送。仅发布新建共享事项,已有私人内容不会自动公开。`}),c?.missingMentions.length?(0,U.jsxs)(`p`,{className:`muted`,children:[`暂无法 @:`,c.missingMentions.join(`、`),`。成员完成下方个人绑定并加入频道后即可生效。`]}):null,c?.pending?(0,U.jsxs)(`p`,{className:`muted`,children:[c.pending,` 条频道消息待发送。`]}):null]})}function yp(){let{request:e}=yf(),t=W((0,R.useCallback)(t=>e(`wecom`,dp,{signal:t}),[e]),3e3),[n,r]=(0,R.useState)(),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(``);(0,R.useEffect)(()=>{t.data?.subscribed&&r(void 0)},[t.data?.subscribed]);async function c(n=!1){a(!0),s(``);try{n?(await e(`wecom`,dp,{method:`DELETE`}),r(void 0)):r(await e(`wecom/code`,fp,{method:`POST`})),await t.reload()}catch(e){s(H(e))}finally{a(!1)}}let l=t.data;return(0,U.jsxs)(`div`,{className:`settings-section stack`,"data-testid":`wecom-project-settings`,children:[(0,U.jsx)(`h2`,{children:`企业微信`}),(0,U.jsx)(`p`,{children:`接收本项目的新消息,并在企业微信中与Tim对话。原消息、回答与回复仍保存在网页。`}),(0,U.jsx)(X,{error:!0,children:t.error||o}),l?.available&&(0,U.jsx)(vp,{}),l?.available&&(0,U.jsx)(`h3`,{children:`个人绑定`}),l?l.available?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{role:`status`,children:[l.subscribed?`个人账号已连接本项目`:`尚未绑定个人账号`,l.pending?` · ${l.pending} 条待转发`:``]}),(0,U.jsx)(X,{error:!0,children:l.error??``}),l.subscribed?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`muted`,children:`引用通知回复即可同步到网页。直接提问进入独立对话;发送 /new 开始新话题,/projects 查看项目,/help 查看全部命令。`}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{disabled:i,onClick:()=>void c(!0),children:`解除本项目连接`})})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`muted`,children:`获取绑定码后,在企业微信中私聊机器人,发送下面的绑定消息。绑定码 10 分钟内有效。`}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{className:`primary`,disabled:i,onClick:()=>void c(),children:i?`生成中…`:n?`重新生成绑定码`:`获取绑定码`})}),n&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(wd,{id:`wecom-bind-command`,label:`绑定消息`,value:`/bind ${n.code}`}),(0,U.jsxs)(`p`,{className:`muted`,children:[`有效至 `,new Date(n.expiresAt).toLocaleTimeString(),`。绑定后自动更新此页面,历史通知仍可在网页查看。`]})]})]})]}):(0,U.jsx)(`p`,{className:`muted`,children:`请管理员先在全局设置中配置企业微信机器人。`}):(0,U.jsx)(`p`,{className:`muted`,children:`加载中…`}),l?.available&&(0,U.jsx)(bp,{})]})}function bp(){let{request:e}=yf(),t=W((0,R.useCallback)(t=>e(`wecom/groups`,pp,{signal:t}),[e]),3e3),[n,r]=(0,R.useState)(),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(``);async function c(){a(!0),s(``);try{r(await e(`wecom/groups/code`,fp,{method:`POST`}))}catch(e){s(H(e))}finally{a(!1)}}async function l(n){a(!0),s(``);try{await e(`wecom/groups/${encodeURIComponent(n)}`,pp,{method:`DELETE`}),await t.reload()}catch(e){s(H(e))}finally{a(!1)}}return(0,U.jsxs)(`section`,{className:`stack`,"data-testid":`wecom-group-settings`,children:[(0,U.jsx)(`h3`,{children:`群接入`}),(0,U.jsx)(`p`,{className:`muted`,children:`将机器人加入群,在群内发送绑定命令。绑定后,群内成员均可 @Tim 提问或分析项目资料,无需个人绑定。`}),(0,U.jsx)(X,{error:!0,children:o||t.error}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{disabled:i,onClick:()=>void c(),children:i?`处理中…`:`获取群绑定码`})}),n&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(wd,{id:`wecom-group-bind-command`,label:`在群内 @Tim 后发送`,value:`/bind ${n.code}`}),(0,U.jsxs)(`p`,{className:`muted`,children:[`有效至 `,new Date(n.expiresAt).toLocaleTimeString(),`。`]})]}),t.data?.groups.map(e=>(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsxs)(`span`,{children:[e.id,` · `,e.boundBy]}),(0,U.jsx)(`button`,{disabled:i,onClick:()=>void l(e.id),children:`解除群连接`})]},e.id)),(0,U.jsx)(`p`,{className:`muted`,children:`群内 /new 开始新话题,/help 查看命令。群聊天不在网页留存;明确收录的资料会保存在本项目。`})]})}function xp({config:e,session:t,reload:n,members:r,onLeave:i,initialTab:a}){let{request:o}=yf(),s=[{id:`general`,title:`基础设置`,icon:`general`},...t.siteRole===`admin`?[{id:`repository`,title:`代码仓库`,icon:`code`}]:[],{id:`members`,title:`成员`,icon:`members`},{id:`connect`,title:`客户端接入`,icon:`connect`},{id:`wecom`,title:`企业微信`,icon:`message`}],[c,l]=(0,R.useState)(a&&s.some(e=>e.id===a)?a:`general`),[u,f]=(0,R.useState)(e),[p,m]=(0,R.useState)(!1),[h,g]=(0,R.useState)(``),[_,v]=(0,R.useState)(``);async function y(){m(!0),g(``),v(``);try{let e=await o(`project/config`,Hc,{method:`PATCH`,body:Gc.parse({projectName:u.projectName,description:u.description})});f(e),v(B.configSaved),n()}catch(e){g(H(e))}finally{m(!1)}}return(0,U.jsxs)(Mf,{title:B.settings,navigation:(0,U.jsx)(gf,{prefix:`settings`,selected:c,onSelect:e=>{l(e);let t=new URL(location.href);e===`general`?t.searchParams.delete(`tab`):t.searchParams.set(`tab`,e),history.replaceState(null,``,t)},tabs:s}),children:[(0,U.jsx)(`section`,{id:`settings-panel-wecom`,role:`tabpanel`,"aria-labelledby":`settings-tab-wecom`,hidden:c!==`wecom`,children:c===`wecom`&&(0,U.jsx)(yp,{})}),(0,U.jsxs)(`section`,{id:`settings-panel-general`,role:`tabpanel`,"aria-labelledby":`settings-tab-general`,hidden:c!==`general`,children:[(0,U.jsxs)(`div`,{className:`settings-section`,children:[(0,U.jsx)(`span`,{hidden:!0,"data-testid":`saved-config-version`,"data-config-revision":e.configRevision}),(0,U.jsxs)(`form`,{"data-testid":`project-settings-form`,"aria-label":B.project,"aria-busy":p,"data-baseline-revision":u.configRevision,className:`stack`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,U.jsxs)(`fieldset`,{disabled:p,className:`stack`,children:[(0,U.jsx)(`h2`,{children:`项目信息`}),(0,U.jsx)(Z,{id:`project-name`,name:`projectName`,label:B.projectName,children:(0,U.jsx)(`input`,{required:!0,maxLength:120,value:u.projectName,onChange:e=>f({...u,projectName:e.target.value})})}),(0,U.jsx)(Z,{id:`project-description`,name:`description`,label:B.description,children:(0,U.jsx)(`textarea`,{rows:3,maxLength:2e3,value:u.description,onChange:e=>f({...u,description:e.target.value})})})]}),(0,U.jsx)(X,{error:!0,children:h}),(0,U.jsx)(X,{children:_}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{"data-testid":`settings-save`,className:`primary`,disabled:p,children:p?B.saving:B.save})})]})]}),(0,U.jsx)(lp,{}),(0,U.jsx)(Rf,{members:r}),t.siteRole===`admin`&&(0,U.jsx)(ap,{onImported:n})]}),t.siteRole===`admin`&&(0,U.jsx)(`section`,{id:`settings-panel-repository`,role:`tabpanel`,"aria-labelledby":`settings-tab-repository`,hidden:c!==`repository`,children:(0,U.jsx)(tp,{members:r})}),(0,U.jsx)(`section`,{id:`settings-panel-members`,role:`tabpanel`,"aria-labelledby":`settings-tab-members`,hidden:c!==`members`,children:(0,U.jsx)(xf,{members:r,session:t,reload:n,onLeave:i})}),(0,U.jsxs)(`section`,{id:`settings-panel-connect`,role:`tabpanel`,"aria-labelledby":`settings-tab-connect`,hidden:c!==`connect`,children:[(0,U.jsxs)(`div`,{className:`settings-section connect-panel`,children:[(0,U.jsx)(`h2`,{children:B.connectTitle}),(0,U.jsx)(`p`,{children:B.connectHint}),(0,U.jsx)(wd,{id:`connect-command`,label:B.connectCommand,value:`teammy connect --url ${cl(e.publicServerUrl)} --project ${cl(e.projectId)}`}),(0,U.jsx)(`p`,{children:B.connectAfter})]}),(0,U.jsxs)(`div`,{className:`settings-section connect-panel`,children:[(0,U.jsx)(`h2`,{children:B.install}),(0,U.jsx)(`p`,{children:B.installHint}),(0,U.jsx)(wd,{id:`install-command`,label:B.installCommandLabel,value:`npm install -g @teammy/cli`})]}),(0,U.jsxs)(`div`,{className:`settings-section connect-panel`,children:[(0,U.jsx)(`h2`,{children:`Agent 接入`}),(0,U.jsx)(`p`,{children:`通过 MCP 查询项目资料,或委托Tim处理工作。`}),(0,U.jsx)(`a`,{href:d(`/downloads/teammy-skill.zip`),download:!0,children:`下载 Teammy skill`})]})]})]})}function Sp({projects:e,session:t,onOpen:n,reload:r}){let[i,a]=(0,R.useState)(!1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Sd,{title:`我的项目`,children:(0,U.jsxs)(xd,{label:`项目操作`,children:[(0,U.jsx)(kd,{icon:`refresh`,label:`刷新项目`,onClick:()=>void r()}),t.siteRole===`admin`&&(0,U.jsxs)(`button`,{className:`primary`,"data-testid":`project-add`,onClick:()=>a(!0),children:[(0,U.jsx)(Od,{name:`plus`}),`新建项目`]})]})}),(0,U.jsx)(`div`,{className:`project-list`,children:e.map(e=>(0,U.jsxs)(`button`,{className:`project-card`,"data-testid":`project-row`,"data-project-id":e.projectId,onClick:()=>n(e.projectId),children:[(0,U.jsx)(Od,{name:`files`,size:`navigation`}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`strong`,{children:e.projectName}),e.description&&(0,U.jsx)(`small`,{children:e.description})]}),(0,U.jsx)(Od,{name:`chevron`})]},e.projectId))}),!e.length&&(0,U.jsx)(yd,{mascot:!0,title:`还没有项目`,description:t.siteRole===`admin`?`创建第一个项目,开始协作。`:`请项目成员添加你的 ID。`,children:t.siteRole===`admin`&&(0,U.jsxs)(`button`,{className:`primary`,"data-testid":`project-add-empty`,onClick:()=>a(!0),children:[(0,U.jsx)(Od,{name:`plus`}),`新建项目`]})}),i&&(0,U.jsx)(Cp,{onClose:()=>a(!1),onCreated:async e=>{await r(),a(!1),n(e)}})]})}function Cp({onClose:e,onCreated:t}){let[n,r]=(0,R.useState)(``),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(``),[c,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)(``),f=(0,R.useRef)({fingerprint:``,id:ll()});return(0,R.useEffect)(()=>{let e=new AbortController;return V(`setup/options`,$d,{signal:e.signal}).then(e=>{e.initialProjectId||r(t=>t||e.projectName)}).catch(()=>{}),()=>e.abort()},[]),(0,U.jsx)(Cd,{id:`project-create-dialog`,title:`新建项目`,onClose:c?()=>{}:e,children:(0,U.jsxs)(`form`,{className:`stack`,"data-testid":`project-create-form`,onSubmit:async e=>{e.preventDefault(),l(!0),d(``);try{let e=JSON.stringify([n,i,o]);f.current.fingerprint!==e&&(f.current={fingerprint:e,id:ll()}),await t((await V(`projects`,Hc,{method:`POST`,body:{operationId:f.current.id,projectName:n,description:i,...o.trim()?{workspacePath:o.trim()}:{}}})).projectId)}catch(e){d(H(e))}finally{l(!1)}},children:[(0,U.jsxs)(`fieldset`,{className:`stack`,disabled:c,children:[(0,U.jsx)(Z,{id:`new-project-name`,label:`项目名称`,children:(0,U.jsx)(`input`,{required:!0,autoFocus:!0,maxLength:120,value:n,onChange:e=>r(e.target.value)})}),(0,U.jsx)(Z,{id:`new-project-description`,label:`说明`,children:(0,U.jsx)(`textarea`,{maxLength:2e3,value:i,onChange:e=>a(e.target.value)})}),(0,U.jsx)(Z,{id:`new-project-workspace`,label:`已有工作区(可选)`,hint:`填写服务器或容器内的 workspaces 绝对路径。Git 仓库可在创建后到项目设置中连接。`,children:(0,U.jsx)(`input`,{value:o,placeholder:`/imports/utu/workspaces`,onChange:e=>s(e.target.value)})})]}),(0,U.jsx)(X,{error:!0,children:u}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{type:`button`,disabled:c,onClick:e,children:`取消`}),(0,U.jsx)(`button`,{className:`primary`,disabled:c,children:`创建项目`})]})]})})}function wp({admin:e,profiles:t,error:n,reload:r}){let[i,a]=(0,R.useState)(),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(0);return(0,U.jsxs)(`section`,{className:`settings-section stack`,"data-testid":`ai-profiles`,children:[(0,U.jsxs)(`div`,{className:`section-heading`,children:[(0,U.jsx)(`h2`,{children:`模型接入`}),e&&(0,U.jsx)(kd,{icon:`plus`,label:`添加模型`,"data-testid":`ai-profile-new`,onClick:()=>{a(void 0),s(!0),l(e=>e+1)}})]}),(0,U.jsx)(X,{error:!0,children:n}),n&&(0,U.jsx)(`button`,{onClick:()=>r(),children:`重新加载模型`}),t?.length===0&&(0,U.jsx)(`p`,{children:`尚未配置模型。`}),t?.map(t=>(0,U.jsxs)(`div`,{className:`application-row ai-model-row`,"data-testid":`ai-profile-row`,"data-profile-id":t.id,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:t.name}),(0,U.jsxs)(`small`,{children:[t.model,` · `,t.enabled?`已启用`:`已停用`]})]}),e&&(0,U.jsx)(kd,{icon:`edit`,label:`配置 ${t.name}`,onClick:()=>{a(t),s(!0),l(e=>e+1)}})]},t.id)),e&&o&&(0,U.jsx)(Ep,{initial:i,onSaved:e=>{a(e),r()},onClose:()=>s(!1)},c),!e&&(0,U.jsx)(`small`,{children:`由管理员维护接入点和密钥。`})]})}function Tp(e){let{revision:t,keyConfigured:n,...r}=e;return Fd.parse(r)}function Ep({initial:e,onSaved:t,onClose:n}){let[r,i]=(0,R.useState)(e?Tp(e):Fd.parse({id:`default`,name:`团队模型`,protocol:`openai-completions`,baseUrl:`http://localhost:8000/v1`,model:`model`})),a=vl(),[o,s]=(0,R.useState)(e),[c,l]=(0,R.useState)(``),[u,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(!1),[m,h]=(0,R.useState)(``),[g,_]=(0,R.useState)(``),v=!o||JSON.stringify(r)!==JSON.stringify(Tp(o))||!!c||u;async function y(){p(!0),h(``),_(``);try{let e=await V(`ai/profiles/${encodeURIComponent(r.id)}`,Id,{method:`PUT`,signal:a,body:Ld.parse({expectedRevision:o?.revision??0,profile:r,...u?{apiKey:null}:c?{apiKey:c}:{}})});s(e),l(``),d(!1),t(e),_(`模型设置已保存。`)}catch(e){h(H(e))}finally{p(!1)}}async function b(){p(!0),h(``),_(``);try{let e=(await op(a)).profiles.find(e=>e.id===o?.id);e&&(s(e),i(Tp(e)),l(``),d(!1),t(e))}catch(e){a.aborted||h(H(e))}finally{p(!1)}}async function ee(e){p(!0),h(``),_(``);try{let t=await V(`ai/profiles/${encodeURIComponent(r.id)}/test`,Vd,{method:`POST`,body:{mode:e},timeoutMs:305e3});_(`${{text:`文本`,tools:`工具往返`,json:`JSON 样例`}[e]}测试通过 · 输入 ${t.inputTokens} / 输出 ${t.outputTokens} token`)}catch(e){h(H(e))}finally{p(!1)}}return(0,U.jsxs)(`form`,{className:`stack`,"data-testid":`ai-profile-form`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,U.jsxs)(`fieldset`,{className:`stack`,disabled:f,children:[(0,U.jsxs)(`div`,{className:`form-grid`,children:[(0,U.jsx)(Z,{id:`ai-profile-id`,label:`模型配置 ID`,children:(0,U.jsx)(`input`,{required:!0,value:r.id,disabled:!!o,onChange:e=>i({...r,id:e.target.value})})}),(0,U.jsx)(Z,{id:`ai-profile-name`,label:`模型名称`,children:(0,U.jsx)(`input`,{required:!0,maxLength:120,value:r.name,onChange:e=>i({...r,name:e.target.value})})})]}),(0,U.jsx)(Z,{id:`ai-profile-protocol`,label:`网关协议`,children:(0,U.jsxs)(`select`,{value:r.protocol,onChange:e=>i({...r,protocol:e.target.value}),children:[(0,U.jsx)(`option`,{value:`openai-completions`,children:`OpenAI Chat Completions`}),(0,U.jsx)(`option`,{value:`openai-responses`,children:`OpenAI Responses`}),(0,U.jsx)(`option`,{value:`anthropic-messages`,children:`Anthropic Messages`})]})}),(0,U.jsx)(Z,{id:`ai-profile-url`,label:`网关地址`,hint:`例如 https://gateway.example/v1;由服务器连接此地址。`,children:(0,U.jsx)(`input`,{required:!0,type:`url`,value:r.baseUrl,onChange:e=>i({...r,baseUrl:e.target.value})})}),(0,U.jsx)(Z,{id:`ai-profile-model`,label:`模型 ID`,children:(0,U.jsx)(`input`,{required:!0,maxLength:200,value:r.model,onChange:e=>i({...r,model:e.target.value})})}),(0,U.jsx)(Z,{id:`ai-profile-key`,label:`API 密钥`,hint:o?.keyConfigured?`已配置;留空保留原密钥。`:`可留空,适用于无需密钥的网关。`,children:(0,U.jsx)(`input`,{type:`password`,autoComplete:`new-password`,maxLength:4096,value:c,disabled:u,onChange:e=>l(e.target.value)})}),o?.keyConfigured&&(0,U.jsxs)(`label`,{children:[(0,U.jsx)(`input`,{type:`checkbox`,"data-testid":`ai-profile-clear-key`,checked:u,onChange:e=>d(e.target.checked)}),` `,`清除已保存密钥`]}),(0,U.jsxs)(`label`,{children:[(0,U.jsx)(`input`,{type:`checkbox`,"data-testid":`ai-profile-enabled`,checked:r.enabled,onChange:e=>i({...r,enabled:e.target.checked})}),` `,`允许创建分析任务`]})]}),(0,U.jsx)(X,{error:!0,children:m}),(0,U.jsx)(X,{children:g}),(0,U.jsxs)(`div`,{className:`row wrap`,children:[(0,U.jsx)(`button`,{className:`primary`,"data-testid":`ai-profile-save`,disabled:f,children:`保存模型`}),(0,U.jsx)(`button`,{type:`button`,disabled:f,onClick:n,children:`关闭配置`})]}),(0,U.jsx)(`div`,{className:`row wrap`,children:[`text`,`tools`,`json`].map(e=>(0,U.jsx)(`button`,{type:`button`,"data-testid":`ai-probe-${e}`,disabled:f||v,onClick:()=>void ee(e),children:{text:`测试文本`,tools:`测试工具`,json:`测试 JSON`}[e]},e))}),o&&(0,U.jsx)(`button`,{type:`button`,"data-testid":`ai-profile-reload`,disabled:f,onClick:()=>void b(),children:`重新载入模型配置`}),(0,U.jsx)(`small`,{children:`测试使用已保存配置和合成内容。JSON 测试仅校验本次样例。`})]})}var Dp=e=>V(`site/config`,Qc,{signal:e});function Op(){let e=W(Dp);return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(X,{error:!0,children:e.error}),e.data&&(0,U.jsx)(Ap,{config:e.data,reload:()=>void e.reload()}),e.data&&(0,U.jsx)(kp,{config:e.data,reload:()=>void e.reload()},e.data.revision),e.error&&(0,U.jsx)(`button`,{onClick:()=>void e.reload(),children:`重试`})]})}function kp({config:e,reload:t}){let[n,r]=(0,R.useState)(e.sync),[i,a]=(0,R.useState)(e.revision),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(``),[u,d]=(0,R.useState)(``);return(0,R.useEffect)(()=>{r(e.sync),a(e.revision),l(``),d(``)},[e]),(0,U.jsx)(`form`,{className:`stack`,"data-testid":`site-sync-form`,"aria-busy":o,"data-config-revision":i,onSubmit:async e=>{e.preventDefault(),s(!0),l(``),d(``);try{let e=await V(`site/config`,Qc,{method:`PATCH`,body:$c.parse({expectedRevision:i,sync:n})});a(e.revision),r(e.sync),d(`已保存,应用于所有项目。`)}catch(e){l(H(e))}finally{s(!1)}},children:(0,U.jsxs)(`section`,{className:`settings-section stack`,children:[(0,U.jsx)(`h2`,{children:`同步策略`}),(0,U.jsxs)(`fieldset`,{disabled:o,className:`form-grid`,children:[(0,U.jsx)(Z,{id:`sync-check-interval`,label:B.interval,children:(0,U.jsx)(`input`,{required:!0,type:`number`,min:1,max:86400,value:n.checkIntervalSeconds,onChange:e=>r({...n,checkIntervalSeconds:Number(e.target.value)})})}),(0,U.jsx)(Z,{id:`sync-file-settle`,label:B.settle,children:(0,U.jsx)(`input`,{required:!0,type:`number`,min:0,max:86400,value:n.fileSettleSeconds,onChange:e=>r({...n,fileSettleSeconds:Number(e.target.value)})})})]}),(0,U.jsx)(X,{error:!0,children:c}),(0,U.jsx)(X,{children:u}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{type:`button`,"aria-label":`刷新同步策略`,"data-testid":`site-sync-refresh`,disabled:o,onClick:t,children:`刷新`}),(0,U.jsx)(`button`,{className:`primary`,"data-testid":`site-sync-save`,disabled:o,children:`保存`})]})]})})}function Ap({config:e,reload:t}){let[n,r]=(0,R.useState)(e.publicServerUrl),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(``);return(0,R.useEffect)(()=>r(e.publicServerUrl),[e.publicServerUrl]),(0,U.jsxs)(`form`,{className:`settings-section stack`,onSubmit:async r=>{r.preventDefault(),a(!0),s(``);try{let r=await V(`site/config`,Qc,{method:`PATCH`,body:{expectedRevision:e.revision,publicServerUrl:n}});r.publicServerUrl===p()?t():location.assign(r.publicServerUrl.replace(/\/$/,``)+`/site-settings`)}catch(e){s(H(e))}finally{a(!1)}},children:[(0,U.jsx)(`h2`,{children:`访问地址`}),(0,U.jsx)(Z,{id:`site-server-url`,label:`服务外部地址`,hint:`包含路径前缀,用于客户端连接、资料链接和 Webhook。`,children:(0,U.jsx)(`input`,{"data-testid":`site-server-url`,required:!0,type:`url`,value:n,onChange:e=>r(e.target.value)})}),(0,U.jsx)(X,{error:!0,children:o}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{className:`primary`,disabled:i,children:`保存地址`})})]})}var jp=e=>V(`users`,I({users:F(el)}),{signal:e});function Mp({me:e}){let t=W(jp),[n,r]=(0,R.useState)();return(0,U.jsxs)(`div`,{className:`settings-section stack`,children:[(0,U.jsx)(bd,{title:`用户信息`,children:(0,U.jsxs)(`button`,{"data-testid":`user-add`,onClick:()=>r({kind:`add`}),children:[(0,U.jsx)(Od,{name:`plus`}),`新增用户`]})}),(0,U.jsx)(`p`,{className:`muted`,children:`建立账号后,在项目设置中添加该用户。`}),(0,U.jsx)(X,{error:!0,children:t.error}),t.error&&(0,U.jsx)(`button`,{onClick:()=>void t.reload(),children:`重试`}),(0,U.jsx)(`div`,{className:`member-list`,children:t.data?.users.map(t=>(0,U.jsxs)(`article`,{className:`member-card`,"data-testid":`user-card`,"data-user-id":t.id,children:[(0,U.jsxs)(`div`,{className:`member-heading`,children:[(0,U.jsx)(_d,{name:t.displayName}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{children:t.displayName}),(0,U.jsxs)(`small`,{children:[t.id,!t.enabled&&` · 已停用`]})]})]}),(0,U.jsxs)(`div`,{className:`member-actions`,children:[(0,U.jsx)(kd,{icon:`edit`,label:`修改显示名称`,"data-testid":`user-edit`,onClick:()=>r({kind:`edit`,user:t})}),t.id!==e&&(0,U.jsx)(kd,{icon:t.enabled?`disable`:`enable`,label:t.enabled?`停用账号`:`启用账号`,"data-testid":`user-toggle`,onClick:()=>r({kind:`toggle`,user:t})})]})]},t.id))}),n&&(0,U.jsx)(Np,{action:n,onClose:()=>r(void 0),onSaved:async()=>{r(void 0),await t.reload()}})]})}function Np({action:e,onClose:t,onSaved:n}){let[r,i]=(0,R.useState)(``),[a,o]=(0,R.useState)(e.kind===`add`?``:e.user.displayName),[s,c]=(0,R.useState)(!1),[l,u]=(0,R.useState)(``),d=e.kind===`add`?`新增用户`:e.kind===`edit`?`修改显示名称`:e.user.enabled?`停用账号`:`启用账号`;return(0,U.jsx)(Cd,{id:`user-dialog`,title:d,onClose:s?()=>{}:t,children:(0,U.jsxs)(`form`,{className:`stack`,"data-testid":`user-form`,"aria-label":d,"aria-busy":s,onSubmit:async t=>{t.preventDefault(),c(!0),u(``);try{e.kind===`add`?await V(`users`,el,{method:`POST`,body:tl.parse({id:r.trim(),displayName:a})}):await V(`users/${encodeURIComponent(e.user.id)}`,el,{method:`PATCH`,body:nl.parse({expectedRevision:e.user.revision,...e.kind===`edit`?{displayName:a}:{enabled:!e.user.enabled}})}),await n()}catch(e){u(H(e))}finally{c(!1)}},children:[e.kind===`add`&&(0,U.jsx)(Z,{id:`user-id`,label:`用户 ID`,hint:B.idHint,children:(0,U.jsx)(`input`,{required:!0,autoFocus:!0,autoComplete:`off`,maxLength:64,pattern:`[a-z][a-z0-9_\\-]{0,63}`,value:r,disabled:s,onChange:e=>i(e.target.value)})}),e.kind===`toggle`?(0,U.jsx)(`p`,{children:e.user.enabled?`停用 ${e.user.id} 后,该用户无法登录或同步任何项目,历史资料会保留。`:`恢复 ${e.user.id} 的登录权限;客户端需要重新接入。`}):(0,U.jsx)(Z,{id:`user-display-name`,label:B.displayName,children:(0,U.jsx)(`input`,{autoFocus:e.kind===`edit`,maxLength:120,value:a,disabled:s,onChange:e=>o(e.target.value)})}),(0,U.jsx)(X,{error:!0,children:l}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{type:`button`,disabled:s,onClick:t,children:B.cancel}),(0,U.jsx)(`button`,{className:`primary`,"data-testid":`user-submit`,disabled:s,children:s?B.saving:B.confirm})]})]})})}function Pp({session:e}){let t=W(op),n=W(ol.server),[r,i]=(0,R.useState)(`general`),[a,o]=(0,R.useState)(0),s=()=>o(e=>e+1),c=()=>{t.reload(),s()};return(0,U.jsxs)(`div`,{className:`site-settings`,children:[(0,U.jsx)(Sd,{title:`设置`}),(0,U.jsx)(gf,{prefix:`site`,orientation:`horizontal`,selected:r,onSelect:i,tabs:[{id:`general`,title:`通用`,icon:`general`},{id:`models`,title:`接入点`,icon:`model`},...e.siteRole===`admin`?[{id:`users`,title:`用户`,icon:`members`},{id:`wecom`,title:`企业微信`,icon:`message`}]:[]]}),(0,U.jsxs)(`div`,{className:`site-settings-content`,children:[e.siteRole===`admin`&&(0,U.jsx)(`section`,{id:`site-panel-wecom`,role:`tabpanel`,"aria-labelledby":`site-tab-wecom`,hidden:r!==`wecom`,children:r===`wecom`&&(0,U.jsx)(_p,{})}),(0,U.jsxs)(`section`,{id:`site-panel-general`,role:`tabpanel`,"aria-labelledby":`site-tab-general`,hidden:r!==`general`,children:[e.siteRole===`admin`?(0,U.jsx)(Op,{}):(0,U.jsx)(`p`,{className:`settings-section muted`,children:`全局同步策略由站点管理员维护。`}),(0,U.jsx)($f,{}),(0,U.jsxs)(`div`,{className:`settings-section`,children:[(0,U.jsx)(`h2`,{children:`服务端版本`}),(0,U.jsx)(X,{error:!0,children:n.error}),(0,U.jsx)(`p`,{"data-testid":`server-version`,children:n.data?.version??`—`})]})]}),(0,U.jsxs)(`section`,{id:`site-panel-models`,role:`tabpanel`,"aria-labelledby":`site-tab-models`,hidden:r!==`models`,children:[(0,U.jsx)(`div`,{className:`settings-section-actions`,children:(0,U.jsx)(kd,{icon:`refresh`,label:`刷新模型设置`,onClick:c})}),(0,U.jsx)(wp,{admin:e.siteRole===`admin`,profiles:t.data?.profiles,error:t.error,reload:c}),(0,U.jsxs)(`section`,{className:`settings-section stack`,"aria-label":`默认接入点`,children:[(0,U.jsx)(`h2`,{children:`默认接入点`}),(0,U.jsx)(X,{error:!0,children:t.error}),t.data&&(0,U.jsx)(U.Fragment,{children:(0,U.jsx)(sp,{title:`全站默认`,profiles:t.data?.profiles??[],admin:e.siteRole===`admin`,generation:a,onChanged:s})})]})]}),e.siteRole===`admin`&&(0,U.jsx)(`section`,{id:`site-panel-users`,role:`tabpanel`,"aria-labelledby":`site-tab-users`,hidden:r!==`users`,children:r===`users`&&(0,U.jsx)(Mp,{me:e.memberId})})]})]})}var Fp=`modulepreload`,Ip=function(e,t){return new URL(e,t).href},Lp={},Rp=function(e){return e.pathname.endsWith(`.css`)},zp=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Bp=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Ip(t,n);let r=s(t),i=Rp(r);return zp(Lp,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Fp,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Vp=(0,R.lazy)(()=>Bp(()=>import(`./Materials-CFm4FvpO.js`).then(e=>({default:e.Materials})),__vite__mapDeps([0,1,2,3]),import.meta.url)),Hp=(0,R.lazy)(()=>Bp(()=>import(`./Files-Ctal40MO.js`).then(e=>({default:e.Files})),__vite__mapDeps([4,1,5,6,2]),import.meta.url)),Up=(0,R.lazy)(()=>Bp(()=>import(`./Assistant-DJV9aVRy.js`).then(e=>({default:e.Assistant})),__vite__mapDeps([7,1,8]),import.meta.url)),Wp=(0,R.lazy)(()=>Bp(()=>import(`./Dashboard-CDLBK91Q.js`).then(e=>({default:e.Dashboard})),__vite__mapDeps([9,5,6,10]),import.meta.url)),Gp=(0,R.lazy)(()=>Bp(()=>import(`./Sessions-CAEjqZpk.js`).then(e=>({default:e.Sessions})),__vite__mapDeps([11,1,5,2,12]),import.meta.url));function Kp(){let[e,t]=(0,R.useState)(),[n,r]=(0,R.useState)(),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(0);return(0,R.useEffect)(()=>{let e=new AbortController;return a(``),(async()=>{try{let n=await ol.setup(e.signal),i;if(n.initialized)try{i=await ol.session(e.signal)}catch(e){if(!(e instanceof il&&e.status===401))throw e}e.signal.aborted||(t(i),r(n.initialized))}catch(t){e.signal.aborted||a(H(t))}})(),()=>e.abort()},[o]),(0,R.useEffect)(()=>{let e=()=>t(void 0);return window.addEventListener(`teammy:logout`,e),()=>window.removeEventListener(`teammy:logout`,e)},[]),i?(0,U.jsxs)(`main`,{className:`boot`,children:[(0,U.jsx)(hd,{}),(0,U.jsx)(X,{error:!0,children:i}),(0,U.jsx)(`button`,{onClick:()=>s(e=>e+1),children:B.retry})]}):n===void 0?(0,U.jsxs)(`main`,{className:`boot`,children:[(0,U.jsx)(hd,{}),(0,U.jsx)(`p`,{role:`status`,children:B.loading})]}):n?e?f()===`/connect`?(0,U.jsx)(df,{session:e,onLogout:()=>t(void 0)}):(0,U.jsx)(hl,{children:(0,U.jsx)(Jp,{session:e,onLogout:()=>t(void 0)})},e.memberId):(0,U.jsx)(nf,{onLogin:t}):(0,U.jsx)(sf,{onDone:e=>{history.replaceState(null,``,d(`/projects`)),r(!0),t(e)}})}function qp(){let e=f().match(/^\/projects\/([a-z][a-z0-9_-]{0,63})\/(dashboard|assistant|files|materials|sessions|members|settings)$/);if(e)return{projectId:e[1],page:e[2]};let t=f()===`/account`?`site-settings`:f().slice(1);return{projectId:``,page:[`projects`,`site-settings`,`members`,...Ef].includes(t)?t:f()===`/ai`?`dashboard`:`projects`}}function Jp({session:e,onLogout:t}){let n=W(ol.projects,!0),[r,i]=(0,R.useState)(qp),a=(0,R.useCallback)((e,t=!1)=>{t?history.replaceState(null,``,d(e)):history.pushState(null,``,d(e)),i(qp()),document.querySelector(`main`)?.focus()},[]);(0,R.useEffect)(()=>{let e=()=>{i(qp())};return window.addEventListener(`popstate`,e),()=>{window.removeEventListener(`popstate`,e)}},[]);let o=n.data?.projects;(0,R.useEffect)(()=>{if(r.page===`members`&&r.projectId){a(Df(r.projectId,`settings`)+`?tab=members`,!0);return}if(r.projectId||!Ef.includes(r.page)&&r.page!==`members`||!o)return;let t=``;try{t=localStorage.getItem(`teammy-project:${e.memberId}`)??``}catch{}let n=o.find(e=>e.projectId===t)??o[0];a(n?Df(n.projectId,r.page===`members`?`settings`:r.page)+(r.page===`members`?`?tab=members`:``):`/projects`,!0)},[r.projectId,r.page,o,a,e.memberId]);let s=o?.find(e=>e.projectId===r.projectId);(0,R.useEffect)(()=>(document.title=s?`${s.projectName} | Teammy 工作台`:`Teammy 工作台`,()=>{document.title=`Teammy 工作台`}),[s?.projectName]),(0,R.useEffect)(()=>{if(s)try{localStorage.setItem(`teammy-project:${e.memberId}`,s.projectId)}catch{}},[s?.projectId,e.memberId]);let c=(0,R.useMemo)(()=>r.projectId?_f(r.projectId):null,[r.projectId]),l=r.page===`projects`||r.page===`site-settings`;return(0,U.jsxs)(`div`,{className:`workspace ${l?`workspace-home`:``}`,children:[(0,U.jsx)(`a`,{className:`skip-link`,href:`#main`,children:B.skipToMain}),!l&&(0,U.jsx)(kf,{projectId:r.projectId,page:r.page,navigate:a}),(0,U.jsx)(`div`,{className:`main-shell`,children:(0,U.jsxs)(`main`,{id:`main`,"data-testid":`workspace-main`,"data-page":r.page,"data-project-id":r.projectId||void 0,tabIndex:-1,children:[(0,U.jsx)(X,{error:!0,children:n.error}),l?(0,U.jsx)(jf,{session:e,navigate:a,onLogout:t,routeKey:r.page,children:r.page===`site-settings`?(0,U.jsx)(Pp,{session:e}):(0,U.jsx)(Sp,{projects:o??[],session:e,reload:n.reload,onOpen:e=>a(Df(e,`dashboard`))})}):c&&s?(0,U.jsx)(vf.Provider,{value:c,children:(0,U.jsx)(Yp,{page:r.page,onLeave:async()=>{await n.reload(),a(`/projects`,!0)}})},r.projectId):o?(0,U.jsx)(X,{error:!0,children:`项目不存在或你已不再是该项目成员。请从项目列表重新选择。`}):(0,U.jsx)(`p`,{role:`status`,children:B.loading})]})})]})}function Yp({page:e,onLeave:t}){let n=yf(),r=W((0,R.useCallback)(async e=>{let[t,r,i]=await Promise.all([n.api.config(e),n.api.members(e),n.request(`identity`,Jc,{signal:e})]);return{config:t,members:r.members,session:i}},[n]),!0),i=r.data;return r.error?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(X,{error:!0,children:r.error}),(0,U.jsx)(`button`,{onClick:()=>void r.reload(),children:`重试`})]}):i?(0,U.jsx)(R.Suspense,{fallback:(0,U.jsx)(`p`,{role:`status`,children:B.loading}),children:e===`files`?(0,U.jsx)(Hp,{members:i.members,me:i.session.memberId,onRefresh:()=>void r.reload()}):e===`dashboard`?(0,U.jsx)(Wp,{members:i.members,config:i.config}):e===`materials`?(0,U.jsx)(Vp,{}):e===`sessions`?(0,U.jsx)(Gp,{members:i.members}):e===`assistant`?(0,U.jsx)(Up,{me:i.session.memberId}):(0,U.jsx)(xp,{config:i.config,session:i.session,reload:()=>void r.reload(),members:i.members,onLeave:t,initialTab:new URLSearchParams(location.search).get(`tab`)??void 0})}):(0,U.jsx)(`p`,{role:`status`,children:B.loading})}(0,Tc.createRoot)(document.getElementById(`root`)).render((0,U.jsx)(Kp,{}));export{h as $,fl as A,z as B,Sd as C,W as D,vl as E,B as F,tc as G,L as H,Nc as I,M as J,N as K,Mc as L,H as M,ll as N,_l as O,rl as P,k as Q,Ac as R,X as S,Td as T,F as U,Ls as V,P as W,xs as X,Js as Y,ys as Z,Z as _,Xf as a,gd as b,Lf as c,mf as d,d as et,pf as f,yd as g,vd as h,Gf as i,il as j,gl as k,Nf as l,Nd as m,Jf as n,s as nt,Yf as o,Pd as p,I as q,Kf as r,l as rt,Pf as s,qf as t,o as tt,yf as u,Od as v,xd as w,Cd as x,kd as y,jc as z};
|
|
Binary file
|
package/dist/web/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<meta name="theme-color" content="#161615" />
|
|
7
7
|
<title>Teammy 工作台</title>
|
|
8
8
|
<link rel="icon" type="image/png" href="./assets/teammy-favicon-BiDvlPj2.png" />
|
|
9
|
-
<script type="module" crossorigin src="./assets/index-
|
|
9
|
+
<script type="module" crossorigin src="./assets/index-DouLQdFE.js"></script>
|
|
10
10
|
<link rel="stylesheet" crossorigin href="./assets/index-CTIAGUGG.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$ as e,A as t,D as n,J as r,M as i,O as a,S as o,W as ee,a as te,b as s,et as ne,f as c,i as l,k as re,n as u,o as d,q as f,r as ie,t as ae,u as oe,v as p,y as se}from"./index-DQsx-e5d.js";import{t as m}from"./Markdown-BRPMsc7D.js";var h=e(),g=t(),_=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}),v=e=>e.replace(/[#*_`>]/g,``).replace(/\s+/g,` `).trim();function y({mine:e=!1,author:t,time:n,children:r}){return(0,g.jsx)(`div`,{className:`assistant-bubble-row ${e?`mine`:``}`,children:(0,g.jsxs)(`div`,{className:`assistant-bubble`,children:[(0,g.jsxs)(`div`,{className:`assistant-bubble-meta`,children:[(0,g.jsx)(`span`,{children:t}),(0,g.jsx)(`time`,{dateTime:n,children:_(n)})]}),r]})})}function b({me:e}){let{projectId:t,request:b}=oe(),S=re(),C=a(t,e,`assistant-selection`),w=a(t,e,`assistant-drafts`),ce=(0,h.useCallback)(e=>b(`agents/outbox`,te,{signal:e}),[b]),T=n(ce,3e3,a(t,e,`outbox`)),le=(0,h.useCallback)(e=>b(`agents/chats`,ae,{signal:e}),[b]),E=n(le,3e3,a(t,e,`chats`)),[D,ue]=(0,h.useState)(()=>{let e=new URLSearchParams(location.search),t=e.get(`chat`);return t?`chat:${t}`:e.get(`message`)??S?.get(C)??``}),O=D.startsWith(`chat:`)?D.slice(5):``,k=!D||!!O,[A,j]=(0,h.useState)(()=>S?.get(a(t,e,`chat`,O))),M=A?.id===O?A:S?.get(a(t,e,`chat`,O)),de=E.data?.chats.find(e=>e.id===O),[fe,N]=(0,h.useState)(),[P,F]=(0,h.useState)(()=>S?.get(w)??{}),I=P[D]??``,L=e=>F(t=>({...t,[D]:e})),[R,z]=(0,h.useState)(!1),[B,V]=(0,h.useState)(!1),[pe,H]=(0,h.useState)(``),[U,W]=(0,h.useState)(``),G=(0,h.useRef)(new Map),K=(0,h.useRef)(null),q=(0,h.useRef)(!0),J=(0,h.useRef)(D);J.current=D,(0,h.useEffect)(()=>{A&&S?.set(a(t,e,`chat`,A.id),A)},[S,t,e,A]),(0,h.useEffect)(()=>{S?.set(w,P)},[S,w,P]);function Y(e){J.current=e,ue(e),S?.set(C,e);let t=new URL(location.href);e.startsWith(`chat:`)?t.searchParams.set(`chat`,e.slice(5)):t.searchParams.delete(`chat`),e&&!e.startsWith(`chat:`)&&e!==`debug`?t.searchParams.set(`message`,e):t.searchParams.delete(`message`),history.replaceState(history.state,``,t)}(0,h.useEffect)(()=>{!D&&E.data?.chats.length&&Y(`chat:${E.data.chats[0].id}`)},[D,E.data]);let X=(T.data?.messages??[]).filter(e=>e.box===`debug`).reverse(),Z=T.data?.messages.find(e=>e.id===(D===`debug`?fe:D));(0,h.useEffect)(()=>{D!==`debug`&&Z?.conversationId&&Y(`chat:${Z.conversationId}`)},[D,Z?.conversationId]);let Q=X.filter(e=>!e.readAt).map(e=>e.id).join(`,`);(0,h.useEffect)(()=>{Z&&!Z.readAt&&D!==`debug`&&b(`agents/outbox/${Z.id}/read`,d,{method:`POST`}).then(()=>{window.dispatchEvent(new Event(`teammy:outbox`)),T.reload()}).catch(e=>H(i(e)))},[Z?.id,Z?.readAt,D,b,T.reload]),(0,h.useEffect)(()=>{D===`debug`&&Q&&Promise.all(Q.split(`,`).map(e=>b(`agents/outbox/${e}/read`,d,{method:`POST`}))).then(()=>{window.dispatchEvent(new Event(`teammy:outbox`)),T.reload()}).catch(e=>H(i(e)))},[D,Q,b,T.reload]),(0,h.useEffect)(()=>{if(W(``),!O)return;let e=!0,n=new EventSource(ne(`/api/v1/projects/${encodeURIComponent(t)}/agents/chats/${encodeURIComponent(O)}/events`));n.addEventListener(`snapshot`,t=>{if(e)try{let e=u.parse(JSON.parse(t.data));if(e.redirect){Y(`chat:${e.redirect}`);return}j(e),W(``)}catch(e){W(i(e))}}),n.onerror=()=>{e&&W(`对话连接中断,正在重新连接…`)},n.addEventListener(`context`,t=>{if(!e)return;let n=u.pick({kind:!0,title:!0,status:!0,visibility:!0,participants:!0,pending:!0,hold:!0,redirect:!0}).parse(JSON.parse(t.data));n.redirect?Y(`chat:${n.redirect}`):j(e=>e?.id===O?{...e,...n}:e)}),n.addEventListener(`message`,t=>{if(!e)return;let n=ie.parse(JSON.parse(t.data));j(e=>e&&{...e,readCursor:Math.max(e.readCursor,n.seq),cursor:Math.max(e.cursor,Number(t.lastEventId)||0),messages:[...e.messages.filter(e=>e.id!==n.id),n].sort((e,t)=>e.seq-t.seq)})}),n.addEventListener(`message_removed`,t=>{if(!e)return;let{id:n}=f({id:r()}).parse(JSON.parse(t.data));j(e=>e?.id===O?{...e,messages:e.messages.filter(e=>e.id!==n)}:e)}),n.addEventListener(`run`,t=>{if(!e)return;let n=l.parse(JSON.parse(t.data));j(e=>e&&{...e,cursor:Math.max(e.cursor,Number(t.lastEventId)||0),runs:e.runs.some(e=>e.id===n.id)?e.runs:[...e.runs,n]})});for(let t of[`delta`,`reset`,`state`])n.addEventListener(t,n=>{if(!e)return;let r=JSON.parse(n.data);j(e=>e&&{...e,cursor:Math.max(e.cursor,Number(n.lastEventId)||0),messages:e.messages.map(e=>e.runId!==r.id||e.role!==`assistant`?e:{...e,body:t===`delta`?e.body+(r.text??``):t===`reset`?``:r.answer??e.body,state:r.state??e.state}),runs:e.runs.map(e=>e.id===r.id?{...e,answer:t===`delta`?e.answer+(r.text??``):t===`reset`?``:r.answer??e.answer,state:r.state??e.state,error:r.error===void 0?e.error:r.error}:e)})});return()=>{e=!1,n.close()}},[t,O]),(0,h.useEffect)(()=>{if(!M?.kind||M.id!==O)return;let e=()=>{document.visibilityState===`visible`&&b(`agents/chats/${O}/read`,f({ok:ee()}),{method:`POST`,body:{cursor:M.readCursor}}).then(()=>{E.reload(),window.dispatchEvent(new Event(`teammy:outbox`))}).catch(e=>H(i(e)))},t=setTimeout(e,300);return document.addEventListener(`visibilitychange`,e),()=>{clearTimeout(t),document.removeEventListener(`visibilitychange`,e)}},[O,M?.readCursor,M?.kind,b]),(0,h.useEffect)(()=>{q.current&&K.current?.scrollIntoView({block:`end`})},[D,A?.messages,Z?.recipients,X.length]);function me(){window.dispatchEvent(new Event(`teammy:outbox`)),T.reload()}async function $(e){if(q.current=!0,Y(e),H(``),N(void 0),e.startsWith(`chat:`)||e===`debug`)return;let t=T.data?.messages.find(t=>t.id===e)?.conversationId;if(t)Y(`chat:${t}`);else try{await b(`agents/outbox/${e}/read`,d,{method:`POST`}),me()}catch(e){H(i(e))}}async function he(){if(!B){V(!0),H(``);try{let e=await b(`agents/chats`,u,{method:`POST`});j(e),await $(`chat:${e.id}`),E.reload()}catch(e){H(i(e))}finally{V(!1)}}}async function ge(e){e.preventDefault();let t=I.trim();if(!t||R||B)return;z(!0),H(``);let n=G.current.get(D);n&&n.text===t||(n={text:t,id:crypto.randomUUID()},G.current.set(D,n));try{if(k){let e=n.target??O;if(!e){let r=await b(`agents/chats`,u,{method:`POST`});e=r.id,n.target=e,G.current.set(`chat:${e}`,n),F(n=>({...n,[`chat:${e}`]:t})),J.current===D&&(j(r),Y(`chat:${e}`))}let i=await b(`agents/chats/${e}`,l.extend({conversationId:r().optional()}),{method:`POST`,body:{text:t,requestId:n.id}});i.conversationId&&i.conversationId!==e&&(J.current===D||J.current===`chat:${e}`)&&Y(`chat:${i.conversationId}`),j(t=>t?.id===e?{...t,runs:t.runs.some(e=>e.id===i.id)?t.runs:[...t.runs,i]}:t),E.reload()}else{let e=await b(`agents/outbox/${Z.id}/reply`,f({conversationId:r()}),{method:`POST`,body:{body:t,requestId:n.id}});me(),J.current===D&&Y(`chat:${e.conversationId}`),E.reload(),N(void 0)}G.current.delete(D),n.target&&G.current.delete(`chat:${n.target}`),F(e=>({...e,[D]:``,...n.target?{[`chat:${n.target}`]:``}:{}}))}catch(e){H(i(e))}finally{z(!1)}}let _e=k||!!Z&&!Z.archivedAt,ve=k&&!M&&(!!O||!E.data);return(0,g.jsxs)(`div`,{className:`split-layout assistant-layout`,"data-testid":`assistant-page`,children:[(0,g.jsxs)(`aside`,{className:`assistant-list`,"aria-label":`消息列表`,children:[(0,g.jsxs)(`header`,{className:`assistant-list-heading`,children:[(0,g.jsx)(`h1`,{children:`消息`}),(0,g.jsx)(se,{className:`assistant-new-chat`,icon:`plus`,label:`新建对话`,disabled:B,onClick:()=>void he(),"data-testid":`assistant-launcher`})]}),(0,g.jsxs)(`div`,{className:`assistant-message-scroll`,children:[E.loading&&!E.data&&(0,g.jsx)(`p`,{className:`assistant-list-status`,role:`status`,children:`加载中…`}),E.data?.chats.map(e=>(0,g.jsxs)(`button`,{type:`button`,"data-testid":`assistant-chat-${e.id}`,className:`assistant-message-item assistant-chat-item ${O===e.id?`selected`:``}`,"aria-pressed":O===e.id,onClick:()=>void $(`chat:${e.id}`),children:[(0,g.jsx)(`span`,{className:`assistant-message-dot ${e.unread||e.state===`running`||e.state===`queued`?`unread`:``}`}),(0,g.jsxs)(`span`,{className:`assistant-message-copy`,children:[(0,g.jsx)(c,{selected:O===e.id,children:(0,g.jsx)(`strong`,{children:e.title})}),(0,g.jsxs)(`time`,{dateTime:e.updatedAt,children:[new Date(e.updatedAt).toLocaleDateString([],{month:`numeric`,day:`numeric`}),` `,_(e.updatedAt)]})]})]},e.id)),!!X.length&&(0,g.jsxs)(`button`,{type:`button`,"data-testid":`debug-outbox`,className:`assistant-message-item ${D===`debug`?`selected`:``}`,onClick:()=>void $(`debug`),children:[(0,g.jsx)(`span`,{className:`assistant-message-dot ${Q?`unread`:``}`}),(0,g.jsxs)(`span`,{className:`assistant-message-copy`,children:[(0,g.jsx)(c,{selected:D===`debug`,children:(0,g.jsx)(`strong`,{children:`运行提醒`})}),(0,g.jsx)(`span`,{children:v(X.at(-1).body)})]})]}),T.data?.messages.filter(e=>e.box!==`debug`&&!e.conversationId).sort((e,t)=>Number(!!e.archivedAt)-Number(!!t.archivedAt)).map(e=>(0,g.jsxs)(`button`,{type:`button`,"data-testid":`outbox-${e.id}`,className:`assistant-message-item ${e.archivedAt?`archived`:``} ${D===e.id?`selected`:``}`,onClick:()=>void $(e.id),children:[(0,g.jsx)(`span`,{className:`assistant-message-dot ${e.readAt?``:`unread`}`}),(0,g.jsxs)(`span`,{className:`assistant-message-copy`,children:[(0,g.jsx)(c,{selected:D===e.id,children:(0,g.jsx)(`strong`,{children:v(e.body)})}),(0,g.jsxs)(`time`,{dateTime:e.createdAt,children:[new Date(e.createdAt).toLocaleDateString([],{month:`numeric`,day:`numeric`}),` `,_(e.createdAt)]})]})]},e.id))]}),(0,g.jsx)(o,{error:!0,children:T.error||E.error})]}),(0,g.jsxs)(`section`,{className:`assistant-thread`,"aria-label":k?`Tim对话`:`消息内容`,children:[(0,g.jsxs)(`header`,{className:`assistant-thread-heading`,children:[(0,g.jsx)(`h2`,{children:k?de?.title??M?.title??(O?`无标题`:`Tim`):D===`debug`?`运行提醒`:`项目消息`}),M?.kind===`matter`&&(0,g.jsxs)(`span`,{className:`assistant-participants`,title:M.participants?.join(`、`),children:[M.visibility===`project`?`项目共享 · `:``,M.participants?.join(`、`)]})]}),M?.kind===`matter`&&(M.hold||M.pending||M.status===`completed`)&&(0,g.jsx)(`div`,{className:`assistant-matter-state`,role:`status`,children:M.hold?`${M.hold.scope===`all`?`已暂停`:`暂缓修改`} · ${M.hold.reason}`:M.pending?`待确认 · ${M.pending.members.join(`、`)}:${M.pending.question}`:`已完成`}),(0,g.jsxs)(`div`,{className:`assistant-transcript`,role:`log`,"aria-live":`polite`,"data-testid":`assistant-transcript`,onScroll:e=>{let t=e.currentTarget;q.current=t.scrollHeight-t.scrollTop-t.clientHeight<100},children:[k?ve?(0,g.jsxs)(`div`,{className:`assistant-empty`,"data-testid":`assistant-loading`,children:[(0,g.jsx)(s,{}),(0,g.jsx)(`p`,{role:`status`,children:U||E.error?`暂时无法加载对话`:`加载中…`})]}):M?.messages.length?M.messages.filter(e=>e.body||[`queued`,`running`,`failed`].includes(e.state)).map(t=>(0,g.jsx)(`div`,{className:`assistant-turn`,children:(0,g.jsxs)(y,{mine:t.role===`user`&&t.author===e,author:`${t.role===`assistant`?`Tim`:t.author}${t.source===`wecom`?` · 企业微信`:``}`,time:t.createdAt,children:[t.body&&(0,g.jsx)(`div`,{className:`markdown`,children:(0,g.jsx)(m,{children:t.body})}),t.role===`assistant`&&[`queued`,`running`].includes(t.state)&&(0,g.jsxs)(`span`,{className:`assistant-typing`,"aria-label":`正在回答`,children:[(0,g.jsx)(`i`,{}),(0,g.jsx)(`i`,{}),(0,g.jsx)(`i`,{})]}),t.state===`failed`&&(0,g.jsx)(o,{error:!0,children:M.runs.find(e=>e.id===t.runId)?.error||`本次回答未完成。`})]})},t.id)):(0,g.jsxs)(`div`,{className:`assistant-empty`,children:[(0,g.jsx)(s,{}),(0,g.jsx)(`p`,{children:`有什么项目问题想聊聊?`})]}):!T.data&&T.loading?(0,g.jsx)(`div`,{className:`assistant-empty`,children:(0,g.jsx)(`p`,{role:`status`,children:`加载中…`})}):D===`debug`?X.map(e=>(0,g.jsx)(x,{item:e,onReply:e.archivedAt?void 0:()=>{N(e.id),L(``),H(``)}},e.id)):Z&&(0,g.jsx)(x,{item:Z}),(0,g.jsx)(`div`,{ref:K})]}),(0,g.jsx)(o,{error:!0,children:pe||(k?U:``)}),_e?(0,g.jsxs)(`form`,{className:`assistant-composer`,onSubmit:e=>void ge(e),children:[(0,g.jsx)(`textarea`,{value:I,disabled:B,onChange:e=>L(e.target.value),"aria-label":k?`向Tim提问`:`回复消息`,placeholder:k?`问问Tim…`:`回复…`,rows:2,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,g.jsx)(`button`,{className:`primary assistant-send`,type:`submit`,disabled:R||B||ve||!I.trim(),"aria-label":`发送`,children:(0,g.jsx)(p,{name:`send`})})]}):D!==`debug`&&Z&&(0,g.jsxs)(`div`,{className:`assistant-archived`,children:[(0,g.jsx)(p,{name:`archive`}),`已归档`]})]})]})}function x({item:e,onReply:t}){return(0,g.jsx)(`div`,{"data-testid":`outbox-thread-${e.id}`,children:(0,g.jsxs)(y,{author:e.box===`debug`?`运行提醒`:`Tim`,time:e.createdAt,children:[(0,g.jsx)(`div`,{className:`markdown`,children:(0,g.jsx)(m,{children:e.body})}),t&&(0,g.jsx)(`button`,{type:`button`,className:`assistant-debug-reply`,onClick:t,children:`回复`})]})})}export{b as Assistant};
|