@teammy/server 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -4209,7 +4209,7 @@ var ProjectActivitySchema = z16.object({
4209
4209
  modelAvailable: z16.boolean(),
4210
4210
  activities: z16.array(
4211
4211
  z16.object({
4212
- kind: z16.enum(["repository", "import", "tasks", "sessions", "project", "chat"]),
4212
+ kind: z16.enum(["repository", "import", "tasks", "sessions", "materials", "project", "chat"]),
4213
4213
  state: z16.enum(["queued", "running", "failed"]),
4214
4214
  count: z16.number().int().positive()
4215
4215
  })
@@ -11562,6 +11562,30 @@ import { parseArgs } from "node:util";
11562
11562
 
11563
11563
  // apps/server/materials/routes.ts
11564
11564
  import { z as z35 } from "zod";
11565
+
11566
+ // apps/server/html-preview.ts
11567
+ function sendHtmlPreview(reply, bytes) {
11568
+ let html;
11569
+ try {
11570
+ html = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
11571
+ if (html.includes("\0")) throw new Error("Binary content");
11572
+ } catch {
11573
+ throw new HubError(400, "INVALID_REQUEST", "\u6B64\u683C\u5F0F\u8BF7\u4E0B\u8F7D\u540E\u67E5\u770B\u3002");
11574
+ }
11575
+ return (
11576
+ // Zero-specificity defaults match the reader, while the original document's
11577
+ // own styles take precedence. A leading doctype also covers HTML fragments.
11578
+ reply.type("text/html; charset=utf-8").header("cache-control", "private, no-store").header("x-content-type-options", "nosniff").header("referrer-policy", "no-referrer").header(
11579
+ "content-security-policy",
11580
+ "sandbox; default-src 'none'; style-src 'unsafe-inline'; img-src data:; font-src data:; base-uri 'none'; form-action 'none'; frame-ancestors 'self'"
11581
+ ).send(`<!doctype html><meta charset="utf-8"><style>
11582
+ :where(body) { margin: 0; color: #161615; font: 16px/1.85 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; overflow-wrap: anywhere; }
11583
+ :where(body > :first-child) { margin-top: 0; }
11584
+ </style>${html}`)
11585
+ );
11586
+ }
11587
+
11588
+ // apps/server/materials/routes.ts
11565
11589
  function registerMaterialRoutes(server, hub) {
11566
11590
  const store = new MaterialStore(hub);
11567
11591
  const params = (value) => z35.object({ id: MaterialIdSchema }).parse(value);
@@ -11608,12 +11632,14 @@ function registerMaterialRoutes(server, hub) {
11608
11632
  });
11609
11633
  server.get("/materials/:id/originals/:hash", async (req, reply) => {
11610
11634
  const { id, hash: hash3 } = z35.object({ id: MaterialIdSchema, hash: HashSchema }).parse(req.params);
11635
+ const { view } = z35.object({ view: z35.literal("html").optional() }).parse(req.query);
11611
11636
  const { bytes, original } = await store.download(
11612
11637
  authorizeWeb(hub, req),
11613
11638
  id,
11614
11639
  hash3,
11615
11640
  revision(req.query)
11616
11641
  );
11642
+ if (view === "html") return sendHtmlPreview(reply, bytes);
11617
11643
  return reply.type("application/octet-stream").header(
11618
11644
  "content-disposition",
11619
11645
  `attachment; filename*=UTF-8''${encodeURIComponent(original.name).replace(/'/g, "%27")}`
@@ -11939,6 +11965,15 @@ function projectActivity(hub, identity) {
11939
11965
  AND n.owner=j.owner AND n.session_key=j.session_key AND n.kind=j.kind AND n.source_revision>j.source_revision)`
11940
11966
  ).all(project);
11941
11967
  for (const row of sessionJobs) add("sessions", row.status);
11968
+ const materials2 = db.prepare(
11969
+ `SELECT CASE m.state
11970
+ WHEN 'waiting' THEN 'queued'
11971
+ WHEN 'failed' THEN 'failed'
11972
+ WHEN 'running' THEN CASE WHEN r.state IN ('queued','failed') THEN r.state ELSE 'running' END
11973
+ END state FROM materials m LEFT JOIN project_agent_runs r ON r.id=m.run_id
11974
+ WHERE m.project_id=? AND m.state!='ready'`
11975
+ ).all(project);
11976
+ for (const row of materials2) add("materials", row.state);
11942
11977
  const inputs = db.prepare(
11943
11978
  `SELECT state FROM project_agent_inbox WHERE project_id=? AND
11944
11979
  (state IN ('queued','running') OR task_id=(SELECT MAX(task_id) FROM project_agent_inbox WHERE project_id=?))`
@@ -12318,7 +12353,9 @@ function registerFileRoutes(server, store) {
12318
12353
  });
12319
12354
  server.get("/blobs/:hash", async (request, reply) => {
12320
12355
  const { hash: hash3 } = z44.object({ hash: HashSchema }).parse(request.params);
12356
+ const { view } = z44.object({ view: z44.literal("html").optional() }).parse(request.query);
12321
12357
  const bytes = await files.download(authorizeRead(store, request), hash3);
12358
+ if (view === "html") return sendHtmlPreview(reply, bytes);
12322
12359
  return reply.type("application/octet-stream").send(Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength));
12323
12360
  });
12324
12361
  const upgradeRequired = () => {
@@ -1 +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
+ 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-BW6ule39.js";import{t as se}from"./Markdown-SFOHcUZw.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-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
+ 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-BW6ule39.js";import{t as v}from"./project-links-XbF78Bal.js";import"./file-links-BHeuStKI.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};
@@ -0,0 +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-BW6ule39.js";import{t as _}from"./Markdown-SFOHcUZw.js";import{t as v}from"./project-links-XbF78Bal.js";import{t as y}from"./file-links-BHeuStKI.js";import{n as b,t as x}from"./WorkspaceTree-B7mZepdd.js";import{t as S}from"./HtmlPreview-Uzm5MRkj.js";var C=e(),w=t();function T(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 E({members:e,me:t,onRefresh:a}){let{api:m,projectId:h}=p(),[_,S]=(0,C.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}),[E,O]=(0,C.useState)(()=>new Set(_?T(_.owner,_.path):[b(t,``)])),[k,A]=(0,C.useState)(()=>_?{..._,kind:`file`}:void 0),[j,M]=(0,C.useState)(0),[N,P]=(0,C.useState)(()=>{let e=new URLSearchParams(location.search);return!_&&(e.has(`owner`)||e.has(`path`))?`文件链接不完整或目标已不可用。`:``}),F=(0,C.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(`/`)),S({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,w.jsxs)(`div`,{className:`split-layout file-explorer`,"data-testid":`file-browser`,children:[(0,w.jsxs)(`aside`,{className:`file-tree-pane`,"aria-label":`文件资源管理器`,children:[(0,w.jsx)(d,{title:`工作区`,icon:`files`,children:(0,w.jsx)(g,{icon:`refresh`,label:`刷新文件`,"data-testid":`files-refresh`,onClick:()=>{P(``),M(e=>e+1),a()}})}),(0,w.jsx)(x,{members:e,expanded:E,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,w.jsx)(`section`,{className:`file-detail`,"data-testid":`file-preview`,"data-owner-id":_?.owner,"data-file-path":_?.path,"aria-label":r.filePreview,children:_?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(o,{error:!0,children:N||!I.loading&&I.error}),I.error&&(0,w.jsx)(`button`,{className:`file-entry-retry`,"data-testid":`files-retry`,onClick:()=>void I.reload(),children:r.retry}),I.loading?(0,w.jsx)(`p`,{className:`preview-body`,role:`status`,children:r.loading}):!I.error&&L&&(0,w.jsx)(D,{owner:L.owner,file:L.file,onLink:B},`${L.owner}:${L.file.path}:${L.file.sha256}`)]}):N?(0,w.jsx)(o,{error:!0,children:N}):(0,w.jsx)(l,{mascot:!0,title:`从一份资料开始`,description:r.pickFile})})]})}function D({owner:e,file:t,onLink:i}){let{readTextBlob:s,blobUrl:c,projectId:l}=p(),[u,d]=(0,C.useState)(!1),f=t.size>524288,v=/\.(md|markdown)$/i.test(t.path),y=/\.html?$/i.test(t.path),b=(0,C.useCallback)(e=>f?Promise.resolve(void 0):s(t,e),[t.sha256,t.size,f]),x=n(b,!1,a(l,`file-body`,t.sha256));return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`header`,{className:`file-detail-header`,children:[(0,w.jsxs)(`span`,{className:`file-detail-path`,title:`${e===`_project`?`workspaces`:e}/${t.path}`,children:[(0,w.jsxs)(`span`,{children:[e===`_project`?`workspaces`:e,` / `]}),t.path]}),(0,w.jsxs)(h,{label:`文件操作`,children:[(v||y)&&(0,w.jsx)(g,{icon:u?`preview`:`code`,label:u?`切换为预览`:`切换为原文`,"data-testid":`file-toggle-raw`,"aria-pressed":u,onClick:()=>d(!u)}),(0,w.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,w.jsx)(m,{name:`download`})})]})]}),f?(0,w.jsx)(`div`,{className:`empty`,children:(0,w.jsx)(`p`,{children:r.previewLarge})}):x.error?(0,w.jsxs)(`div`,{className:`preview-body`,children:[(0,w.jsx)(o,{error:!0,children:x.error}),(0,w.jsx)(`button`,{"data-testid":`file-preview-retry`,onClick:()=>void x.reload(),children:r.retry})]}):x.loading?(0,w.jsx)(`p`,{className:`preview-body`,role:`status`,children:r.loading}):(0,w.jsx)(`div`,{className:`preview-body${y&&!u?` preview-body-html`:``}`,children:y&&!u?(0,w.jsx)(S,{url:c(t.sha256),name:t.path.split(`/`).at(-1)}):v&&!u?(0,w.jsx)(`article`,{className:`markdown`,"data-testid":`file-content`,"data-format":`markdown`,children:(0,w.jsx)(_,{onLink:i,children:x.data??``})}):(0,w.jsx)(`pre`,{className:`raw`,"data-testid":`file-content`,"data-format":`text`,children:x.data})})]})}export{E as Files};
@@ -0,0 +1 @@
1
+ import{A as e}from"./index-BW6ule39.js";var t=e();function n({url:e,name:n}){return(0,t.jsx)(`iframe`,{className:`html-preview`,title:`${n} 预览`,src:`${e}${e.includes(`?`)?`&`:`?`}view=html`,sandbox:``,referrerPolicy:`no-referrer`})}export{n as t};
@@ -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-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(`
1
+ import{$ as e,A as t,F as n,et as r,nt as i,rt as a,tt as o}from"./index-BW6ule39.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:`
@@ -0,0 +1,6 @@
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-BW6ule39.js";import{n as D,r as O,t as k}from"./Markdown-SFOHcUZw.js";import{i as A,r as ee}from"./WorkspaceTree-B7mZepdd.js";import{t as j}from"./HtmlPreview-Uzm5MRkj.js";function M(e){return l(p,e)}var N=e(),P=i().regex(/^R\d{6,}$/),F=x({name:i().min(1),sha256:u,size:a().int().nonnegative()}),I=m().refine(e=>/^https?:\/\//i.test(e),`Use an HTTP or HTTPS URL.`);x({operationId:h(),title:i().trim().default(``),text:i().optional(),url:I.optional(),originals:f(F).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(F).optional()}).strict();var L=x({id:P,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(F),content:i().nullable(),summary:i().nullable(),state:r([`waiting`,`running`,`ready`,`failed`]),error:i().nullable(),url:i()}),R=x({materials:f(L),nextCursor:a().nullable()});x({query:i().trim().min(1),scope:r([`all`,`workspace`,`materials`]).default(`all`),materialId:P.optional(),originalHash:u.optional(),after:i().default(``),limit:M().int().min(1).max(200).default(30)}).strict();var z=x({items:f(x({key:i(),kind:r([`workspace`,`materials`]),title:i(),snippet:i(),url:i(),path:i()})),nextCursor:i().nullable()}),B=t();function te(e){let t=(e.content??``).trimStart().split(`
2
+ `);return t[0]?.replace(/^#\s+/,``).trim()===e.title.trim()&&t[0].startsWith(`# `)&&t.shift(),t.join(`
3
+ `).trimStart()}function V(){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 H(){let{request:e,projectId:t}=S(),[r,i]=(0,N.useState)(V),[a,s]=(0,N.useState)(r),[l,u]=(0,N.useState)(()=>new Set(r?[r.id]:[])),[f,p]=(0,N.useState)(!1),[m,h]=(0,N.useState)(``),[g,x]=(0,N.useState)(``),[w,E]=(0,N.useState)(``),[D,O]=(0,N.useState)([]),[j,M]=(0,N.useState)(),[P,F]=(0,N.useState)(!1),[I,z]=(0,N.useState)(``),H=(0,N.useRef)(null),U=(0,N.useCallback)(t=>e(`materials`,R,{signal:t}),[e]),W=n(U,5e3,c(t,`materials`)),G=(0,N.useCallback)(t=>r?e(`materials/${encodeURIComponent(r.id)}${r.revision?`?revision=${encodeURIComponent(r.revision)}`:``}`,L,{signal:t}):Promise.resolve(null),[e,r?.id,r?.revision]),K=n(G,5e3),q=K.data?.id===r?.id?K.data:null,J=[...new Map([...D,...W.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?W.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,N.useEffect)(()=>{let e=()=>{let e=V();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),z(``);try{let t=await e(`materials?before=${Y}`,R);O(e=>[...e,...t.materials]),M(t.nextCursor)}catch(e){z(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(``),H.current?.focus()}return(0,B.jsxs)(`div`,{className:`split-layout file-explorer session-explorer`,"data-testid":`materials-page`,children:[(0,B.jsxs)(`aside`,{className:`file-tree-pane`,"aria-label":`资料目录`,children:[(0,B.jsx)(b,{title:`资料`,icon:`materials`,children:(0,B.jsx)(T,{icon:`plus`,label:`新增资料`,onClick:()=>{p(!0),z(``)}})}),(0,B.jsx)(d,{error:!0,children:W.error||I}),W.data?J.length===0?(0,B.jsx)(`p`,{className:`tree-status`,children:`暂无资料`}):(0,B.jsx)(`div`,{role:`tree`,"aria-label":`项目资料`,onKeyDown:ee,children:J.map(e=>(0,B.jsxs)(`div`,{role:`none`,children:[(0,B.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,B.jsx)(`span`,{className:`tree-chevron ${l.has(e.id)?`expanded`:``}`,children:(0,B.jsx)(C,{name:`chevron`,size:`small`})}),children:[(0,B.jsx)(C,{name:`files`}),(0,B.jsx)(`span`,{className:`tree-name`,children:e.title})]}),l.has(e.id)&&(0,B.jsx)(`div`,{role:`group`,children:[...e.originals].sort((e,t)=>A(e.name,t.name)).map((t,n)=>(0,B.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,B.jsx)(`span`,{className:`tree-chevron`}),children:[(0,B.jsx)(C,{name:`file`}),(0,B.jsx)(`span`,{className:`tree-name`,children:t.name})]},`${t.sha256}:${n}`))})]},e.id))}):(0,B.jsx)(`p`,{className:`tree-status`,children:`加载中…`}),Y&&(0,B.jsx)(`button`,{className:`tree-action`,disabled:P,onClick:()=>void ae(),children:P?`加载中…`:`加载更多`})]}),(0,B.jsxs)(`section`,{className:`session-reader`,"aria-label":`资料内容与搜索`,children:[(0,B.jsx)(`div`,{className:`session-reader-content`,children:f?(0,B.jsx)(ie,{onCancel:()=>p(!1),onSaved:e=>{X({id:e}),W.reload()}}):g?(0,B.jsx)(ne,{query:g,scope:a,onSelect:e=>X(e,g)},`${g}/${a?.id}/${a?.original}`):r?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(d,{error:!0,children:K.error}),q?r.original?(0,B.jsx)(re,{material:q,hash:r.original,highlight:w},`${q.id}:${r.original}`):(0,B.jsxs)(`article`,{className:`material-body`,children:[(0,B.jsx)(`h1`,{children:q.title}),r.revision&&(0,B.jsx)(`button`,{className:`material-link`,onClick:()=>X({id:r.id}),children:`查看最新内容`}),!r.revision&&(q.state===`waiting`||q.state===`running`)?(0,B.jsx)(`p`,{className:`muted`,role:`status`,children:`正在整理…`}):null,(0,B.jsx)(d,{error:!0,children:q.error??``}),!r.revision&&q.state===`failed`&&(0,B.jsx)(`button`,{onClick:()=>void e(`materials/${r.id}/retry`,L,{method:`POST`}).then(()=>K.reload()).catch(e=>z(o(e))),children:`重试整理`}),q.content?(0,B.jsx)(`div`,{className:`markdown`,children:(0,B.jsx)(k,{highlight:w,children:te(q)})}):(0,B.jsx)(`p`,{className:`muted`,children:`正文尚未整理,可以先查看左侧原件。`})]}):(0,B.jsx)(`p`,{role:`status`,children:`加载中…`})]}):(0,B.jsx)(y,{mascot:!0,title:`选择资料开始阅读`,description:`也可以在下方搜索资料内容。`})}),!f&&(0,B.jsxs)(`form`,{className:`session-search-dock`,"data-testid":`material-search-form`,onSubmit:e=>{e.preventDefault(),x(m.trim()),E(``)},children:[a&&(0,B.jsxs)(`button`,{type:`button`,className:`search-scope-chip`,title:`清除搜索范围`,"aria-label":`清除范围:${Q}`,onClick:$,children:[(0,B.jsxs)(`span`,{className:`scope-label`,children:[`搜索:`,Q]}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`×`})]}),(0,B.jsxs)(`div`,{className:`session-search-input-row`,children:[(0,B.jsx)(`input`,{ref:H,"aria-label":`搜索资料`,placeholder:`搜索资料内容`,value:m,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Backspace`&&!m&&a&&(e.preventDefault(),$())}}),(g||m||w)&&(0,B.jsx)(T,{icon:`close`,label:`清空搜索`,onClick:()=>{h(``),x(``),E(``),H.current?.focus()}}),(0,B.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,N.useState)(``),s=(0,N.useCallback)(n=>i(`resources/search?${new URLSearchParams({query:e,scope:`materials`,after:a,...t?{materialId:t.id}:{},...t?.original?{originalHash:t.original}:{}})}`,z,{signal:n}),[i,e,t?.id,t?.original,a]),c=n(s);return(0,B.jsxs)(`section`,{className:`session-results stack`,"aria-label":`搜索结果`,children:[(0,B.jsx)(d,{error:!0,children:c.error}),c.loading?(0,B.jsx)(`p`,{role:`status`,children:`正在搜索…`}):c.data?.items.length===0?(0,B.jsx)(`p`,{className:`empty`,children:`没有找到匹配的资料`}):c.data?.items.map(t=>(0,B.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,B.jsx)(`strong`,{children:t.title.replace(/^R\d+ · /,``)}),(0,B.jsx)(`span`,{className:`session-excerpt`,children:(0,B.jsx)(D,{value:O(t.snippet,e),query:e})})]},t.key)),c.data?.nextCursor&&(0,B.jsx)(`button`,{disabled:c.loading,onClick:()=>o(c.data.nextCursor),children:`下一页`})]})}function re({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,N.useState)(!1),u=(0,N.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,B.jsx)(d,{error:!0,children:`找不到此原件。`});let p=/\.(md|markdown)$/i.test(a.name),m=/\.html?$/i.test(a.name);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`header`,{className:`file-detail-header`,children:[(0,B.jsx)(`span`,{className:`file-detail-path`,children:a.name}),(0,B.jsxs)(`div`,{className:`toolbar-actions`,children:[(p||m)&&(0,B.jsx)(T,{icon:s?`preview`:`code`,label:s?`切换为预览`:`切换为原文`,"aria-pressed":s,onClick:()=>l(!s)}),(0,B.jsx)(`a`,{className:`icon-button`,"aria-label":`下载原件`,title:`下载原件`,href:o,download:a.name,children:(0,B.jsx)(C,{name:`download`})})]})]}),(0,B.jsx)(d,{error:!0,children:f.error}),f.loading?(0,B.jsx)(`p`,{role:`status`,children:`加载中…`}):f.data===null?(0,B.jsx)(`p`,{className:`muted`,children:`此格式请下载后查看。`}):f.data!==void 0&&(0,B.jsx)(`div`,{className:`preview-body${m&&!s?` preview-body-html`:``}`,"data-testid":`material-original-content`,children:m&&!s?(0,B.jsx)(j,{url:o,name:a.name}):p&&!s?(0,B.jsx)(`article`,{className:`markdown`,children:(0,B.jsx)(k,{highlight:r,children:f.data})}):(0,B.jsx)(`pre`,{className:`raw`,children:(0,B.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
+ `)[0]?.slice(0,80)||`文本`}}function G(e){try{return new URL(e.trim()).href}catch{return e.trim().split(`
5
+ `).slice(1).join(`
6
+ `)}}function ie({onSaved:e,onCancel:t}){let{request:n,projectId:r}=S(),[i,a]=(0,N.useState)([]),[c,l]=(0,N.useState)(),[u,f]=(0,N.useState)(!1),[p,m]=(0,N.useState)(``),h=(0,N.useRef)(null),_=(0,N.useRef)(s()),y=(0,N.useRef)(new Map);function b(e){a(e),_.current=s(),m(``)}async function x(){f(!0),m(``);try{let t=[];for(let[e,n]of i.entries()){let i=y.current.get(n.id);if(!i){let t=n.kind===`file`?n.file.name:`${W(n.text)}.txt`,a=await fetch(v(`/api/v1/projects/${r}/materials/uploads`),{method:`POST`,headers:{"content-type":`application/octet-stream`,"x-teammy-web":`1`},body:n.kind===`file`?n.file:new Blob([n.text],{type:`text/plain`})}),o=await a.json();if(!a.ok)throw Error(o.error?.message??`第 ${e+1} 项上传失败。`);i={name:t,sha256:o.sha256,size:o.size},y.current.set(n.id,i)}t.push(i)}let a=i.length===1&&i[0]?.kind===`text`?i[0].text.trim():``,o;try{let e=new URL(a);[`http:`,`https:`].includes(e.protocol)&&(o=e.href)}catch{}e((await n(`materials`,L,{method:`POST`,body:{operationId:_.current,originals:t,...o?{url:o}:{}}})).id)}catch(e){m(o(e))}finally{f(!1)}}return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`form`,{className:`material-form`,onSubmit:e=>{e.preventDefault(),x()},children:[(0,B.jsx)(`h1`,{children:`新增资料`}),(0,B.jsx)(`p`,{className:`muted`,children:`上传附件到项目,以便于Tim进行理解`}),(0,B.jsx)(d,{error:!0,children:p}),(0,B.jsxs)(`fieldset`,{disabled:u,children:[(0,B.jsxs)(`div`,{className:`attachment-grid`,children:[i.map(e=>(0,B.jsxs)(`article`,{className:`attachment-card`,"data-testid":`attachment-card`,children:[e.kind===`text`?(0,B.jsxs)(`button`,{type:`button`,className:`attachment-content`,"aria-label":`编辑:${W(e.text)}`,onClick:()=>l({id:e.id,text:e.text}),children:[(0,B.jsx)(C,{name:U(e)}),(0,B.jsx)(`span`,{className:`attachment-name`,children:W(e.text)}),G(e.text)&&(0,B.jsx)(`span`,{className:`attachment-excerpt`,children:G(e.text)})]}):(0,B.jsxs)(`div`,{className:`attachment-content`,children:[(0,B.jsx)(C,{name:U(e)}),(0,B.jsx)(`span`,{className:`attachment-name`,children:e.file.name})]}),(0,B.jsx)(T,{className:`attachment-remove`,icon:`close`,label:`移除:${e.kind===`file`?e.file.name:W(e.text)}`,onClick:()=>{y.current.delete(e.id),b(i.filter(t=>t.id!==e.id))}})]},e.id)),(0,B.jsxs)(`button`,{type:`button`,className:`attachment-add`,onClick:()=>l({text:``}),children:[(0,B.jsx)(C,{name:`addText`}),(0,B.jsx)(`span`,{children:`添加文本/链接`})]}),(0,B.jsxs)(`button`,{type:`button`,className:`attachment-add`,onClick:()=>h.current?.click(),children:[(0,B.jsx)(C,{name:`addFile`}),(0,B.jsx)(`span`,{children:`添加文件`})]})]}),(0,B.jsx)(`input`,{ref:h,type:`file`,multiple:!0,hidden:!0,"aria-label":`原始文件`,onChange:e=>{b([...i,...[...e.target.files??[]].map(e=>({id:s(),kind:`file`,file:e}))]),e.target.value=``}}),(0,B.jsxs)(`div`,{className:`actions attachment-actions`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:t,children:`取消`}),(0,B.jsx)(`button`,{type:`submit`,className:`primary`,disabled:!i.length,children:u?`上传中…`:`提交资料`})]})]})]}),c&&(0,B.jsx)(w,{id:`material-text-editor`,title:`添加文本/链接`,onClose:()=>l(void 0),children:(0,B.jsxs)(`form`,{className:`stack`,onSubmit:e=>{if(e.preventDefault(),!c.text.trim())return;let t={id:c.id??s(),kind:`text`,text:c.text};y.current.delete(t.id),b(c.id?i.map(e=>e.id===c.id?t:e):[...i,t]),l(void 0)},children:[(0,B.jsx)(g,{id:`material-attachment-text`,label:`文本或链接`,children:(0,B.jsx)(`textarea`,{autoFocus:!0,rows:8,value:c.text,onChange:e=>l({...c,text:e.target.value}),placeholder:`粘贴文本或网页链接`})}),(0,B.jsx)(`div`,{className:`actions`,children:(0,B.jsx)(`button`,{type:`submit`,className:`primary`,disabled:!c.text.trim(),children:c.id?`保存`:`添加`})})]})})]})}export{H as Materials};
@@ -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-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
+ 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-BW6ule39.js";import{n as j,r as M,t as N}from"./Markdown-SFOHcUZw.js";import{n as P}from"./project-links-XbF78Bal.js";import{i as F,r as I}from"./WorkspaceTree-B7mZepdd.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};