lantern-harness 0.1.22 → 0.1.23
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/CHANGELOG.md +20 -0
- package/dist/500.html +4 -4
- package/dist/_astro/{Base.I--fR8aT.css → Base.GThhapKd.css} +1 -1
- package/dist/_astro/Base.astro_astro_type_script_index_0_lang.CWRCetQl.js +2 -0
- package/dist/_astro/{CasesLibrary.DfuTkbJN.js → CasesLibrary.CDjuLV_E.js} +2 -2
- package/dist/_astro/ChatApp.Td2xCiQG.js +216 -0
- package/dist/_astro/{DashboardBoard.D8-oufgg.js → DashboardBoard.D-zHXRds.js} +1 -1
- package/dist/_astro/DocsFileBrowser.BM3nH4VD.js +1 -0
- package/dist/_astro/{KnowledgeLibrary.DGhU2p3S.js → KnowledgeLibrary.D9KnqXzr.js} +1 -1
- package/dist/_astro/{PluginsPage.DjeMQX3i.js → PluginsPage.DBRfSxtq.js} +2 -2
- package/dist/_astro/PluginsPage.DMDyUktn.js +1 -0
- package/dist/_astro/PromptMountDialog.CpTT6L0a.js +62 -0
- package/dist/_astro/{PromptsLibrary.CbGja6mq.js → PromptsLibrary.sz6MivVn.js} +1 -1
- package/dist/_astro/{ReqAnalysisBoard.By08xNFf.js → ReqAnalysisBoard.CazI9SU-.js} +1 -1
- package/dist/_astro/RequirementsLibrary.R4dNZa9y.js +1 -0
- package/dist/_astro/{SettingsDialog.DgpH_BVN.js → SettingsDialog.Bs1I8b27.js} +1 -1
- package/dist/_astro/{UiAutoBoard.nrtcQJDl.js → UiAutoBoard.B-7mL3ez.js} +1 -1
- package/dist/_astro/app-version.yT2l6J8H.js +1 -0
- package/dist/_astro/docs-format.BlGh-XA_.js +1 -0
- package/dist/_astro/{story-review.E_go1fvj.js → story-review.BbdIf5zg.js} +1 -1
- package/dist/case-exec/index.html +4 -4
- package/dist/cases/generate/index.html +4 -4
- package/dist/cases/library/index.html +5 -5
- package/dist/dashboard/index.html +5 -5
- package/dist/docs/changelog/index.html +23 -5
- package/dist/docs/install/index.html +4 -4
- package/dist/docs/manual/index.html +8 -7
- package/dist/knowledge/index.html +5 -5
- package/dist/plugins/index.html +5 -5
- package/dist/pm/bugs/index.html +4 -4
- package/dist/pm/iterations/index.html +4 -4
- package/dist/pm/projects/detail/index.html +4 -4
- package/dist/pm/projects/index.html +4 -4
- package/dist/pm/requirements/index.html +4 -4
- package/dist/prompts/index.html +5 -5
- package/dist/reports/index.html +4 -4
- package/dist/requirement-analysis/index.html +5 -5
- package/dist/requirements/index.html +5 -5
- package/dist/tasks/index.html +4 -4
- package/dist/templates/index.html +4 -4
- package/dist/test-automation/index.html +5 -5
- package/dist/test-stats/index.html +4 -4
- package/dist/todos/index.html +4 -4
- package/dist/workbench/index.html +5 -5
- package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +4 -3
- package/lh-plugins/lh-reports.mjs +6 -5
- package/package.json +1 -1
- package/dist/_astro/Base.astro_astro_type_script_index_0_lang.BQtZbum2.js +0 -1
- package/dist/_astro/ChatApp.CAgrwilW.js +0 -214
- package/dist/_astro/DocsFileBrowser.CTICuWFf.js +0 -1
- package/dist/_astro/PluginsPage.C9vaY-lo.js +0 -1
- package/dist/_astro/PromptMountDialog.YH2odDZx.js +0 -58
- package/dist/_astro/RequirementsLibrary.BSDgdppH.js +0 -1
- package/dist/_astro/app-version.5UudQEyk.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.CF1xVPmo.js";import{i as r,o as i,s as a}from"./plugins.CVM1IaoC.js";import{t as o}from"./jsx-runtime.DUg_B_vD.js";import{t as s}from"./ConfirmDialog.CsMwWevK.js";import{showToast as c}from"./Toast.BO2NFckG.js";import{c as l,n as u,r as d,u as f}from"./project-docs.DAw9bzgk.js";import{n as p}from"./doc-roots.DAJP9Svr.js";import{i as m,n as h,r as g,t as _}from"./DocsFileBrowser.
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.CF1xVPmo.js";import{i as r,o as i,s as a}from"./plugins.CVM1IaoC.js";import{t as o}from"./jsx-runtime.DUg_B_vD.js";import{t as s}from"./ConfirmDialog.CsMwWevK.js";import{showToast as c}from"./Toast.BO2NFckG.js";import{c as l,n as u,r as d,u as f}from"./project-docs.DAw9bzgk.js";import{n as p}from"./doc-roots.DAJP9Svr.js";import{i as m,n as h,r as g,t as _}from"./DocsFileBrowser.BM3nH4VD.js";import{t as v,u as y}from"./open-docs-in-session.Cj0J2-XT.js";var b=e(t(),1),x=o(),S=10;async function C(e=`.`){let{entries:t}=await l(`knowledge`,e),n=[];for(let e of t)e.type===`file`?e.name.endsWith(`.md`)&&n.push(e):n.push(...await C(e.path));return n}function w({staticCount:e=0,base:t}){let o=g(`knowledge`),[l,w]=(0,b.useState)(!1),[T,E]=(0,b.useState)(!0),[D,O]=(0,b.useState)(o?!0:null),[k,A]=(0,b.useState)(()=>o??[]),[j,M]=(0,b.useState)(null),[N,P]=(0,b.useState)(!1),[F,I]=(0,b.useState)({}),[L,R]=(0,b.useState)(null),z=h(k,S,`knowledge`),B=(0,b.useCallback)(async()=>{M(null);try{let e=await C(`.`);A(e),m(`knowledge`,e)}catch(e){M(e instanceof Error?e.message:String(e))}},[]);(0,b.useEffect)(()=>{let e=i(e=>E(!!e.knowledgeLib));return n().then(()=>{E(r(`knowledgeLib`)),w(!0)}),e},[]),(0,b.useEffect)(()=>{l&&T&&(async()=>{await d(`knowledge`)?(await y().catch(()=>null),await B(),O(!0)):O(!1)})()},[l,T,B]);let V=(0,b.useMemo)(()=>Object.keys(F).filter(e=>F[e]),[F]);function H(){r(`knowledgeGen`)?window.location.href=`${t}workbench/?plugin=knowledgeGen`:M(a(`knowledgeGen`))}async function U(e){P(!0),M(null);try{await f(`knowledge`,e.path)}catch(e){M(e instanceof Error?e.message:String(e))}finally{P(!1)}}async function W(e){P(!0),M(null);try{await v(`knowledge`,e)}catch(e){M(e instanceof Error?e.message:String(e)),P(!1)}}async function G(){let e=L;if(e){R(null),P(!0),M(null);try{if(e.kind===`one`)await u(`knowledge`,e.entry.path);else{for(let t of e.paths)await u(`knowledge`,t);I({})}await B(),c(e.kind===`one`?`已删除「${e.entry.name}」`:`已删除 ${e.paths.length} 个知识库文件`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);M(t),c(`删除失败:${t}`,`error`)}finally{P(!1)}}}let K=L?.kind===`one`?`删除「${L.entry.name}」?将从 ${p(`knowledge`)} 中移除。`:L?.kind===`batch`?`确认删除已选中的 ${L.paths.length} 个知识库文件?此操作不可恢复。`:``;return l?T?D===null?(0,x.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在连接本地文档服务`,children:(0,x.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,x.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):D?(0,x.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,children:[(0,x.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,x.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0`,children:[z.query.trim()?(0,x.jsxs)(x.Fragment,{children:[`匹配 `,(0,x.jsx)(`span`,{className:`font-medium text-stone-800`,children:z.filtered.length}),` 个`,(0,x.jsxs)(`span`,{className:`text-stone-400`,children:[` · 共 `,k.length]})]}):(0,x.jsxs)(x.Fragment,{children:[`共 `,(0,x.jsx)(`span`,{className:`font-medium text-stone-800`,children:k.length}),` 个知识库文件`]}),V.length>0?(0,x.jsxs)(`span`,{className:`text-stone-400`,children:[` · 已选 `,V.length]}):null]}),(0,x.jsx)(`button`,{type:`button`,disabled:N||V.length===0,onClick:()=>R({kind:`batch`,paths:V}),className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-red-600 border border-red-200 rounded-lg hover:bg-red-50 disabled:opacity-40`,children:`批量删除`}),(0,x.jsx)(`button`,{type:`button`,disabled:N,onClick:H,className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40`,children:`生成知识库`})]}),j?(0,x.jsx)(`div`,{className:`shrink-0 mx-4 mt-3 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:j}):null,(0,x.jsx)(_,{resizeKey:`docs:knowledge:cols:v1`,files:k,filtered:z.filtered,pageFiles:z.pageFiles,query:z.query,onQuery:z.setQuery,sortBy:z.sortBy,onSortBy:z.setSortBy,page:z.page,totalPages:z.totalPages,pageSize:z.pageSize,onPage:z.setPage,onPageSize:z.setPageSize,busy:N,emptyText:`暂无知识库文件,点击「生成知识库」前往我的工作台。`,searchPlaceholder:`搜索文件名或路径…`,selected:F,onToggleRow:e=>I(t=>({...t,[e]:!t[e]})),onSelectPage:(e,t)=>I(n=>{let r={...n};for(let n of e)t?r[n]=!0:delete r[n];return r}),onRowDoubleClick:e=>void U(e),renderBadge:e=>{let t=e.path.includes(`/`)?e.path.split(`/`)[0]:``;return t?(0,x.jsx)(`span`,{className:`shrink-0 text-[10px] px-1.5 py-0.5 rounded bg-amber-50 text-amber-800 border border-amber-100`,children:t}):null},renderActions:e=>(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{type:`button`,disabled:N,onClick:()=>void W(e),className:`text-xs whitespace-nowrap text-white bg-[#4176e6] px-2 py-1 rounded hover:bg-[#3565c7] cursor-pointer disabled:opacity-40`,children:`在会话中打开`}),(0,x.jsx)(`button`,{type:`button`,disabled:N,onClick:()=>R({kind:`one`,entry:e}),className:`text-xs whitespace-nowrap text-red-600 hover:bg-red-50 px-2 py-1 rounded cursor-pointer disabled:opacity-40`,children:`删除`})]})}),(0,x.jsx)(s,{open:L!=null,title:L?.kind===`batch`?`批量删除`:`删除知识库文件`,message:K,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>R(null),onConfirm:()=>void G()})]}):(0,x.jsxs)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:[`知识库管理需要本地文档服务,当前未就绪`,e>0?`(构建期约有 ${e} 份文档可浏览)`:``,`。`]}):(0,x.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:a(`knowledgeLib`)}):(0,x.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,x.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,x.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}export{w as default};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.CF1xVPmo.js";import{a as r,l as i,o as a,r as o,t as s}from"./plugins.CVM1IaoC.js";import{o as c}from"./case-exec.BipZCK6G.js";import{t as l}from"./jsx-runtime.DUg_B_vD.js";import{t as u}from"./OverflowHint.pvo2Xc8R.js";import{showToast as d}from"./Toast.BO2NFckG.js";import{k as f}from"./req-analysis.dhgy4p2f.js";import"./settings.B1yetppp.js";import{M as ee,j as
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.CF1xVPmo.js";import{a as r,l as i,o as a,r as o,t as s}from"./plugins.CVM1IaoC.js";import{o as c}from"./case-exec.BipZCK6G.js";import{t as l}from"./jsx-runtime.DUg_B_vD.js";import{t as u}from"./OverflowHint.pvo2Xc8R.js";import{showToast as d}from"./Toast.BO2NFckG.js";import{k as f}from"./req-analysis.dhgy4p2f.js";import"./settings.B1yetppp.js";import{M as ee,j as te}from"./case-review.C1hQRbQ2.js";import{s as p}from"./fs-tools.3F9MFrLf.js";import{F as m,v as h}from"./pm.pMOkNqqK.js";import{s as g,w as _}from"./tasks.BNBkrFC3.js";import{c as v}from"./report-prompt.CAfZ6RIo.js";import{r as y}from"./test-stats.MEm3K2rB.js";import{a as b}from"./ui-auto-prompt.l_EXfDs5.js";import{o as x,v as S}from"./story-review.BbdIf5zg.js";var C=e(t(),1),w=`/__tb_memory`,T=3e3,E=`你可以使用跨会话长期记忆(本机五轨:user / memory / key / project / daily):
|
|
2
2
|
- 系统可能已在 <memory_snapshot> 注入用户档案、全局事实与项目关键记忆;优先参考。
|
|
3
3
|
- 查历史进展:memory_search 或 memory_read(project / daily 不自动注入)。
|
|
4
4
|
- 用户明确要求记住偏好/全局事实/项目约定:调用 memory_suggest(进待确认,确认后才注入)。
|
|
5
5
|
- 回合进展写入:memory_append 到 project 或 daily(无需确认)。
|
|
6
6
|
- 不要把寒暄、一次性闲聊写入记忆。`,D=[{type:`function`,function:{name:`memory_search`,description:`在五轨记忆中按关键词搜索条目。`,parameters:{type:`object`,properties:{query:{type:`string`,description:`搜索关键词`}},required:[`query`]}}},{type:`function`,function:{name:`memory_read`,description:`读取某一轨的全部条目。target: user|memory|key|project|daily`,parameters:{type:`object`,properties:{target:{type:`string`,enum:[`user`,`memory`,`key`,`project`,`daily`]}},required:[`target`]}}},{type:`function`,function:{name:`memory_suggest`,description:`提议写入用户档案/全局事实/项目关键(user|memory|key)。写入待确认队列,用户采纳后才生效。`,parameters:{type:`object`,properties:{target:{type:`string`,enum:[`user`,`memory`,`key`]},content:{type:`string`,description:`要记住的事实(简洁)`},reason:{type:`string`,description:`为何值得记住`}},required:[`target`,`content`]}}},{type:`function`,function:{name:`memory_append`,description:`向项目日志或每日日志追加进展(直写,无需确认)。`,parameters:{type:`object`,properties:{target:{type:`string`,enum:[`project`,`daily`]},content:{type:`string`}},required:[`target`,`content`]}}}];async function O(e,t={},n){let r=await fetch(`${w}${e}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t),signal:n}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(i.error??`HTTP ${r.status}`);return i}async function k(e){let t=await fetch(`${w}${e}`),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.error??`HTTP ${t.status}`);return n}async function A(){try{let e=await fetch(`${w}/health`,{signal:AbortSignal.timeout(1500)});return e.ok?await e.json():null}catch{return null}}async function j(){try{return(await k(`/config`)).config??null}catch{return null}}async function M(e){return(await O(`/config`,e)).config}async function N(e=``){try{let t=await O(`/snapshot`,{cwd:e},AbortSignal.timeout(T));return typeof t.text==`string`?t.text:``}catch{return``}}async function P(e=``,t=`all`){let n=await O(`/tracks`,{cwd:e,target:t});return t===`all`?{tracks:n.tracks??{},projectId:n.projectId}:{tracks:{[t]:{entries:n.entries??[],path:n.path,target:t}},projectId:n.projectId}}async function F(){return(await k(`/suggestions`)).suggestions??[]}async function I(e){await O(`/suggestions/approve`,{id:e})}async function L(e){await O(`/suggestions/reject`,{id:e})}async function R(e,t,n=``){await O(`/archive`,{target:e,index:t,cwd:n})}async function z(e,t,n=``){await O(`/delete`,{target:e,index:t,cwd:n})}async function B(e,t,n=``){await O(`/archives/delete`,{target:e,index:t,cwd:n})}async function V(e,t=``){return(await O(`/archives`,{target:e,cwd:t})).entries??[]}async function H(e,t,n=``){await O(`/promote`,{target:e,index:t,cwd:n})}async function U(e,t,n=``){await O(`/manual-add`,{target:e,content:t,cwd:n})}async function W(e,t){let n=t?.cwd??``,r=t?.maxChars??8e3;try{let e=await N(n);return e.length>r&&(e=`${e.slice(0,r-20)}\n…\n</memory_snapshot>`),{context:e,hits:[]}}catch{return{context:``,hits:[]}}}var G=/记住|记下|别忘了|以后都|请记得|我喜欢|我的偏好|默认用|默认显示|默认城市|约定|不要再|以后默认/;async function K(e,t=``){let n=e.trim();if(!n||n.length<4||!G.test(n))return!1;let r=n.length>400?`${n.slice(0,400)}…`:n;try{return await O(`/suggest`,{cwd:t,target:/偏好|喜欢|习惯|称呼|默认/.test(n)?`user`:`memory`,content:r,reason:`用户话术触发自动沉淀`}),!0}catch{return!1}}async function q(e,t,n=``){let r={};try{r=JSON.parse(t||`{}`)}catch{return JSON.stringify({error:`invalid JSON arguments`})}try{switch(e){case`memory_search`:{let e=await O(`/search`,{query:r.query,cwd:n});return JSON.stringify(e)}case`memory_read`:{let e=await O(`/tracks`,{target:r.target,cwd:n});return JSON.stringify(e)}case`memory_suggest`:{let e=await O(`/suggest`,{target:r.target,content:r.content,reason:r.reason,cwd:n});return JSON.stringify(e)}case`memory_append`:{let e=await O(`/append`,{target:r.target,content:r.content,cwd:n});return JSON.stringify(e)}case`memory_create_entities`:case`memory_add_observations`:{let e=Array.isArray(r.entities)?r.entities:[],t=Array.isArray(r.observations)?r.observations:[],i=[];for(let t of e){let e=t,n=(e.observations??[]).join(`;`);i.push(n?`${e.name}: ${n}`:String(e.name??``))}for(let e of t){let t=e;i.push(`${t.entityName}: ${(t.contents??[]).join(`;`)}`)}let a=i.filter(Boolean).join(`
|
|
7
|
-
`);if(!a)return JSON.stringify({error:`empty`});let o=await O(`/suggest`,{target:`memory`,content:a,reason:`兼容旧工具调用`,cwd:n});return JSON.stringify(o)}case`memory_create_relations`:return JSON.stringify({ok:!0,skipped:!0,note:`五轨模式不使用关系图`});case`memory_open_nodes`:{let e=await O(`/search`,{query:Array.isArray(r.names)?r.names.join(` `):``,cwd:n});return JSON.stringify(e)}default:return JSON.stringify({error:`unknown tool: ${e}`})}}catch(e){return JSON.stringify({error:e instanceof Error?e.message:String(e)})}}async function J(e){}var Y=l(),X={tasks:`侧栏「任务管理」按状态列出任务;工作台可直接增删改`,todos:`侧栏「待办事项」按状态 / 紧急程度分组;工作台可直接增删改`,projects:`侧栏「项目列表」管理项目并汇总迭代 / 需求 / 缺陷;工作台可直接增删改`,iterations:`侧栏「迭代管理」按项目维护迭代周期、进度与逾期;工作台可直接增删改`,pmRequirements:`侧栏「需求管理」维护需求编号 / 优先级 / 状态与验收标准;工作台可直接增删改`,bugs:`侧栏「缺陷管理」记录严重程度 / 重现步骤与修复状态;工作台可直接增删改`,testStats:`侧栏「测试统计」按维度记录每天的统计数量`,caseExec:`侧栏「用例执行统计」按项目记录用例执行情况`,dashboard:`侧栏「仪表盘」聚合待办 / 任务 / 测试统计;卡片可拖动排序、拖角改宽高,右上角编辑组件`},Z={tasks:_,todos:v,projects:g,iterations:g,pmRequirements:g,bugs:g,testStats:S,caseExec:c,dashboard:v},ne=[{id:`all`,label:`全部`},{id:`on`,label:`已启用`},{id:`off`,label:`未启用`}],Q=o();function re({embedded:e=!1}){let[t,o]=(0,C.useState)(()=>r()),[c,l]=(0,C.useState)(null),[u,g]=(0,C.useState)(null),[_,v]=(0,C.useState)(null),[S,w]=(0,C.useState)(!0),[T,E]=(0,C.useState)(``),[D,O]=(0,C.useState)(`all`),[k,j]=(0,C.useState)(null),[M,N]=(0,C.useState)({});async function P(){w(!0);try{let[e,t,n,r,i,a,o,s,c,u,d]=await Promise.all([A(),m(),Z.tasks(),Z.todos(),Z.projects(),Z.iterations(),Z.pmRequirements(),Z.bugs(),Z.testStats(),Z.caseExec(),Z.dashboard()]);l(e),g(t),v({tasks:n,todos:r,projects:i,iterations:a,pmRequirements:o,bugs:s,testStats:c,caseExec:u,dashboard:d})}finally{w(!1)}}(0,C.useEffect)(()=>{let e=a(e=>o(e));return n().then(()=>{o(r()),P()}),()=>{e()}},[]);function F(e){if(e===`cases`)return{available:!0,detail:`侧栏「用例管理」浏览与维护本空间用例库`};if(e===`caseGen`)return t.cases?{available:!0,detail:`对话输入 / 打开配置面板,生成用例并写入用例库`}:{available:!1,detail:`需先启用「用例管理」,生成结果才能写入用例列表`};if(e===`prompts`)return{available:!0,detail:`侧栏「提示词管理」浏览与维护本空间提示词库`};if(e===`promptGen`)return t.prompts?{available:!0,detail:`对话输入 / 打开配置面板,生成提示词并写入提示词库`}:{available:!1,detail:`需先启用「提示词管理」,生成结果才能写入提示词列表`};if(e===`knowledgeLib`)return{available:!0,detail:`侧栏「知识库管理」浏览与维护本空间知识库`};if(e===`requirements`)return{available:!0,detail:`侧栏「需求文档库」浏览与维护本空间需求文档`};if(e===`templates`)return{available:!0,detail:`侧栏「测试模板库」浏览与维护本空间用例模板`};if(e===`reports`)return{available:!0,detail:`侧栏「工作汇报」按日报 / 周报 / 月报列出汇报文件`};if(e===`tasks`||e===`todos`||e===`projects`||e===`iterations`||e===`pmRequirements`||e===`bugs`||e===`testStats`||e===`caseExec`||e===`dashboard`){let t=_?.[e];return t===void 0?{available:S?null:!1,detail:S?`探测中…`:`需本地服务`}:t?{available:!0,detail:X[e]}:{available:!1,detail:`需本地服务(npm run dev / lantern web)`}}return e===`knowledgeGen`?t.knowledgeLib?{available:!0,detail:`对话输入 / 打开配置面板,生成文档并写入知识库`}:{available:!1,detail:`需先启用「知识库管理」,生成结果才能写入知识库列表`}:e===`memory`?S&&c===null?{available:null,detail:`探测中…`}:c?.ok?{available:!0,detail:`已连接 · ${c.entryCount??c.entityCount??0} 条记忆 / 待确认 ${c.suggestionCount??0}`}:{available:!1,detail:`本地记忆服务未就绪`}:e===`knowledge`?{available:!0,detail:`对话输入 @ 可引用知识库与模板文档`}:e===`pluginDev`?S&&u===null?{available:null,detail:`探测中…`}:u?.ok?{available:!0,detail:`固定提示词开发扩展插件;先评估确认,再改代码并入「扩展插件」`}:{available:!1,detail:`需本地文件服务:开发要读写项目源码`}:{available:!1,detail:`未知`}}function I(e){let n=i(e,!t[e]),r=!!n[e],a=s.find(t=>t.id===e)?.name??e;o(n),d(r?`已启用「${a}」`:`已停用「${a}」`,`success`),e===`reports`&&y(!!n.reports).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`工作汇报提示词没生成成功:${t}`,`error`)}),e===`uiAuto`&&te(!!n.uiAuto).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`UI自动化测试提示词没生成成功:${t}`,`error`)}),e===`reqAnalysis`&&f(!!n.reqAnalysis).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`需求分析提示词没生成成功:${t}`,`error`)}),e===`storyReview`&&b(!!n.storyReview).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`用户故事审查提示词没生成成功:${t}`,`error`)}),e===`testPoints`&&x(!!n.testPoints).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`测试点生成提示词没生成成功:${t}`,`error`)}),(e===`caseReview`||e===`cases`)&&ee(!!n.caseReview).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`用例质量评审提示词没生成成功:${t}`,`error`)}),(e===`caseBlindspot`||e===`cases`)&&p(!!n.caseBlindspot).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`场景遗漏补全提示词没生成成功:${t}`,`error`)}),(e===`projects`||e===`iterations`||e===`pmRequirements`||e===`bugs`)&&n[e]&&h().catch(e=>{console.warn(`[pm] 同步项目管理数据目录失败`,e)})}let L=(0,C.useMemo)(()=>s.filter(e=>t[e.id]).length,[t]),R=T.trim().toLowerCase(),z=(0,C.useMemo)(()=>Q.map(e=>({...e,items:e.items.filter(e=>{let n=!R||e.name.toLowerCase().includes(R)||e.id.toLowerCase().includes(R)||e.description.toLowerCase().includes(R),r=D===`all`||(D===`on`?t[e.id]:!t[e.id]);return n&&r})})).filter(e=>e.items.length>0),[t,R,D]);return(0,Y.jsx)(`div`,{className:`tw-plugins-page overflow-y-auto ${e?`h-full min-h-0 flex-1`:`min-h-screen`}`,children:(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-[1080px] ${e?`px-6 py-5`:`px-6 py-7`}`,children:[(0,Y.jsxs)(`header`,{className:`tw-plugins-head`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`text-[20px] font-semibold tracking-tight text-stone-900`,children:`我的插件`}),(0,Y.jsxs)(`p`,{className:`mt-1.5 text-[13px] leading-6 text-stone-500`,children:[`按用途分组的扩展能力,开关保存在本机;会话 / 全局内置能力在`,(0,Y.jsx)(`span`,{className:`mx-1 rounded bg-stone-100 px-1 py-0.5 text-[12px] text-stone-600`,children:`设置 → 内置插件`}),`里查看。`]})]}),(0,Y.jsxs)(`div`,{className:`tw-plugins-stats`,"aria-label":`插件概览`,children:[(0,Y.jsxs)(`div`,{className:`tw-plugins-stat`,children:[(0,Y.jsx)(`span`,{className:`tw-plugins-stat-num`,children:s.length}),(0,Y.jsx)(`span`,{className:`tw-plugins-stat-label`,children:`个插件`})]}),(0,Y.jsxs)(`div`,{className:`tw-plugins-stat`,children:[(0,Y.jsx)(`span`,{className:`tw-plugins-stat-num is-on`,children:L}),(0,Y.jsx)(`span`,{className:`tw-plugins-stat-label`,children:`已启用`})]}),(0,Y.jsxs)(`div`,{className:`tw-plugins-stat`,children:[(0,Y.jsx)(`span`,{className:`tw-plugins-stat-num`,children:Q.length}),(0,Y.jsx)(`span`,{className:`tw-plugins-stat-label`,children:`个分类`})]})]})]}),(0,Y.jsxs)(`div`,{className:`tw-plugins-toolbar`,children:[(0,Y.jsxs)(`label`,{className:`relative block w-full max-w-72`,children:[(0,Y.jsxs)(`svg`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-stone-400`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:[(0,Y.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,Y.jsx)(`path`,{d:`m20 20-3.5-3.5`})]}),(0,Y.jsx)(`input`,{value:T,onChange:e=>E(e.target.value),placeholder:`搜索插件名 / 作用`,className:`h-9 w-full rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-[13px] text-stone-800 outline-none transition-colors placeholder:text-stone-400 focus:border-[#4176e6]`})]}),(0,Y.jsx)(`div`,{className:`tw-plugins-pills`,role:`group`,"aria-label":`按状态筛选`,children:ne.map(e=>(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":D===e.id,onClick:()=>O(e.id),children:e.label},e.id))})]}),(0,Y.jsxs)(`div`,{className:`mt-4 space-y-6`,children:[z.map(e=>{let n=!!M[e.category],r=e.items.filter(e=>t[e.id]).length;return(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":!n,onClick:()=>N(t=>({...t,[e.category]:!n})),className:`mb-2.5 flex w-full items-center gap-2 text-left`,children:[(0,Y.jsx)($,{className:`h-3.5 w-3.5 shrink-0 text-stone-400 transition-transform ${n?`-rotate-90`:``}`}),(0,Y.jsx)(`span`,{className:`text-[13px] font-semibold text-stone-800`,children:e.category}),(0,Y.jsxs)(`span`,{className:`rounded-full bg-stone-100 px-1.5 py-0.5 text-[11px] tabular-nums text-stone-500`,children:[r,`/`,e.items.length]}),(0,Y.jsx)(`span`,{className:`ml-1 h-px flex-1 bg-stone-200/70`,"aria-hidden":`true`})]}),n?null:(0,Y.jsx)(`ul`,{className:`tw-anim-list tw-plugin-grid`,children:e.items.map(e=>{let n=t[e.id],r=F(e.id),i=k===`ext:${e.id}`;return(0,Y.jsx)(`li`,{className:`relative z-0 min-w-0 overflow-visible hover:z-40 focus-within:z-40${i?` z-40`:``}`,children:(0,Y.jsx)(ie,{open:i,onToggleOpen:()=>j(i?null:`ext:${e.id}`),title:e.name,subtitle:e.description,badge:(0,Y.jsxs)(`span`,{className:`rounded border border-stone-200 px-1.5 py-0.5 text-[11px] tabular-nums text-stone-400`,children:[`v`,e.version]}),trailing:e.alwaysOn?(0,Y.jsx)(`span`,{className:`rounded border border-stone-200 px-1.5 py-0.5 text-[11px] text-stone-500`,children:`内置`}):(0,Y.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n,"aria-label":`${n?`关闭`:`打开`} ${e.name}`,onClick:()=>I(e.id),className:`tw-toggle`,children:(0,Y.jsx)(`span`,{className:`tw-toggle-knob`})}),fullName:`@lh-plugins/${e.id}`,configLabel:e.alwaysOn?`内置常开`:n?`已启用`:`未启用`,runLabel:n&&r.available===!0?`运行中`:`已停用`,extra:r.detail})},e.id)})})]},e.category)}),z.length?null:(0,Y.jsxs)(`div`,{className:`rounded-xl border border-dashed border-stone-200 bg-white/60 px-4 py-12 text-center`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-stone-600`,children:`没有匹配的插件`}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-stone-400`,children:`换个关键词,或把状态筛选切回「全部」。`})]})]})]})})}function ie(e){let{open:t,onToggleOpen:n,title:r,subtitle:i,badge:a,trailing:o,fullName:s,configLabel:c,runLabel:l,extra:d}=e;return(0,Y.jsxs)(`div`,{className:`tw-plugin-card group/card relative z-0 self-start w-full overflow-visible rounded-xl border bg-white transition-colors hover:z-40 focus-within:z-40 ${t?`z-40 border-[#4176e6]/50 shadow-sm`:`border-stone-200 hover:border-stone-300`}`,children:[(0,Y.jsxs)(`div`,{className:`relative flex h-17 items-start gap-3 overflow-visible px-4 py-3`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:n,className:`relative h-full min-w-0 flex-1 overflow-visible text-left outline-none focus:outline-none`,"aria-expanded":t,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`min-w-0 truncate text-[14px] font-medium text-stone-900`,children:r}),a,(0,Y.jsx)($,{className:`h-3.5 w-3.5 shrink-0 text-stone-400 transition-transform duration-300 ease-out ${t?`rotate-180`:``}`})]}),(0,Y.jsx)(u,{text:i,className:`mt-1 block min-w-0 truncate text-[13px] leading-5 text-stone-500`,disabled:t})]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 self-start pt-0.5`,children:o})]}),(0,Y.jsx)(`div`,{className:`tw-collapse ${t?`is-open`:``}`,"aria-hidden":!t,children:(0,Y.jsx)(`div`,{className:`tw-collapse-inner`,children:(0,Y.jsx)(`div`,{className:`border-t border-stone-100 px-4 pb-3 pt-0`,children:(0,Y.jsxs)(`dl`,{className:`mt-2.5 space-y-1.5 text-[13px]`,children:[(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`完整名称`}),(0,Y.jsx)(`dd`,{className:`min-w-0 break-all font-mono text-[12px] text-stone-700`,children:s})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`配置状态`}),(0,Y.jsx)(`dd`,{className:`text-stone-700`,children:c})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`运行状态`}),(0,Y.jsx)(`dd`,{className:l===`运行中`?`text-emerald-600`:`text-stone-500`,children:l})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`简介`}),(0,Y.jsx)(`dd`,{className:`text-[12px] leading-5 text-stone-500`,children:i})]}),d?(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`说明`}),(0,Y.jsx)(`dd`,{className:`text-[12px] leading-5 text-stone-500`,children:d})]}):null]})})})})]})}function $({className:e}){return(0,Y.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,className:e,"aria-hidden":!0,children:(0,Y.jsx)(`path`,{d:`m6 9 6 6 6-6`})})}export{W as _,R as a,M as b,J as c,A as d,P as f,H as g,K as h,I as i,V as l,U as m,E as n,B as o,F as p,D as r,z as s,re as t,j as u,L as v,q as y};
|
|
7
|
+
`);if(!a)return JSON.stringify({error:`empty`});let o=await O(`/suggest`,{target:`memory`,content:a,reason:`兼容旧工具调用`,cwd:n});return JSON.stringify(o)}case`memory_create_relations`:return JSON.stringify({ok:!0,skipped:!0,note:`五轨模式不使用关系图`});case`memory_open_nodes`:{let e=await O(`/search`,{query:Array.isArray(r.names)?r.names.join(` `):``,cwd:n});return JSON.stringify(e)}default:return JSON.stringify({error:`unknown tool: ${e}`})}}catch(e){return JSON.stringify({error:e instanceof Error?e.message:String(e)})}}async function J(e){}var Y=l(),X={tasks:`侧栏「任务管理」按状态列出任务;工作台可直接增删改`,todos:`侧栏「待办事项」按状态 / 紧急程度分组;工作台可直接增删改`,projects:`侧栏「项目列表」管理项目并汇总迭代 / 需求 / 缺陷;工作台可直接增删改`,iterations:`侧栏「迭代管理」按项目维护迭代周期、进度与逾期;工作台可直接增删改`,pmRequirements:`侧栏「需求管理」维护需求编号 / 优先级 / 状态与验收标准;工作台可直接增删改`,bugs:`侧栏「缺陷管理」记录严重程度 / 重现步骤与修复状态;工作台可直接增删改`,testStats:`侧栏「测试统计」按维度记录每天的统计数量`,caseExec:`侧栏「用例执行统计」按项目记录用例执行情况`,dashboard:`侧栏「仪表盘」聚合待办 / 任务 / 测试统计;卡片可拖动排序、拖角改宽高,右上角编辑组件`},Z={tasks:g,todos:_,projects:h,iterations:h,pmRequirements:h,bugs:h,testStats:y,caseExec:c,dashboard:_},ne=[{id:`all`,label:`全部`},{id:`on`,label:`已启用`},{id:`off`,label:`未启用`}],Q=o();function re({embedded:e=!1}){let[t,o]=(0,C.useState)(()=>r()),[c,l]=(0,C.useState)(null),[u,h]=(0,C.useState)(null),[g,_]=(0,C.useState)(null),[y,w]=(0,C.useState)(!0),[T,E]=(0,C.useState)(``),[D,O]=(0,C.useState)(`all`),[k,j]=(0,C.useState)(null),[M,N]=(0,C.useState)({});async function P(){w(!0);try{let[e,t,n,r,i,a,o,s,c,u,d]=await Promise.all([A(),p(),Z.tasks(),Z.todos(),Z.projects(),Z.iterations(),Z.pmRequirements(),Z.bugs(),Z.testStats(),Z.caseExec(),Z.dashboard()]);l(e),h(t),_({tasks:n,todos:r,projects:i,iterations:a,pmRequirements:o,bugs:s,testStats:c,caseExec:u,dashboard:d})}finally{w(!1)}}(0,C.useEffect)(()=>{let e=a(e=>o(e));return n().then(()=>{o(r()),P()}),()=>{e()}},[]);function F(e){if(e===`cases`)return{available:!0,detail:`侧栏「用例管理」浏览与维护本空间用例库`};if(e===`caseGen`)return t.cases?{available:!0,detail:`对话输入 / 打开配置面板,生成用例并写入用例库`}:{available:!1,detail:`需先启用「用例管理」,生成结果才能写入用例列表`};if(e===`prompts`)return{available:!0,detail:`侧栏「提示词管理」浏览与维护本空间提示词库`};if(e===`promptGen`)return t.prompts?{available:!0,detail:`对话输入 / 打开配置面板,生成提示词并写入提示词库`}:{available:!1,detail:`需先启用「提示词管理」,生成结果才能写入提示词列表`};if(e===`knowledgeLib`)return{available:!0,detail:`侧栏「知识库管理」浏览与维护本空间知识库`};if(e===`requirements`)return{available:!0,detail:`侧栏「需求文档库」浏览与维护本空间需求文档`};if(e===`templates`)return{available:!0,detail:`侧栏「测试模板库」浏览与维护本空间用例模板`};if(e===`reports`)return{available:!0,detail:`侧栏「工作汇报」按日报 / 周报 / 月报列出汇报文件`};if(e===`tasks`||e===`todos`||e===`projects`||e===`iterations`||e===`pmRequirements`||e===`bugs`||e===`testStats`||e===`caseExec`||e===`dashboard`){let t=g?.[e];return t===void 0?{available:y?null:!1,detail:y?`探测中…`:`需本地服务`}:t?{available:!0,detail:X[e]}:{available:!1,detail:`需本地服务(npm run dev / lantern web)`}}return e===`knowledgeGen`?t.knowledgeLib?{available:!0,detail:`对话输入 / 打开配置面板,生成文档并写入知识库`}:{available:!1,detail:`需先启用「知识库管理」,生成结果才能写入知识库列表`}:e===`memory`?y&&c===null?{available:null,detail:`探测中…`}:c?.ok?{available:!0,detail:`已连接 · ${c.entryCount??c.entityCount??0} 条记忆 / 待确认 ${c.suggestionCount??0}`}:{available:!1,detail:`本地记忆服务未就绪`}:e===`knowledge`?{available:!0,detail:`对话输入 @ 可引用知识库与模板文档`}:e===`pluginDev`?y&&u===null?{available:null,detail:`探测中…`}:u?.ok?{available:!0,detail:`固定提示词开发扩展插件;先评估确认,再改代码并入「扩展插件」`}:{available:!1,detail:`需本地文件服务:开发要读写项目源码`}:{available:!1,detail:`未知`}}function I(e){let n=i(e,!t[e]),r=!!n[e],a=s.find(t=>t.id===e)?.name??e;o(n),d(r?`已启用「${a}」`:`已停用「${a}」`,`success`),e===`reports`&&v(!!n.reports).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`工作汇报提示词没生成成功:${t}`,`error`)}),e===`uiAuto`&&b(!!n.uiAuto).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`UI自动化测试提示词没生成成功:${t}`,`error`)}),e===`reqAnalysis`&&f(!!n.reqAnalysis).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`需求分析提示词没生成成功:${t}`,`error`)}),e===`storyReview`&&x(!!n.storyReview).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`用户故事审查提示词没生成成功:${t}`,`error`)}),e===`testPoints`&&S(!!n.testPoints).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`测试点生成提示词没生成成功:${t}`,`error`)}),(e===`caseReview`||e===`cases`)&&ee(!!n.caseReview).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`用例质量评审提示词没生成成功:${t}`,`error`)}),(e===`caseBlindspot`||e===`cases`)&&te(!!n.caseBlindspot).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`场景遗漏补全提示词没生成成功:${t}`,`error`)}),(e===`projects`||e===`iterations`||e===`pmRequirements`||e===`bugs`)&&n[e]&&m().catch(e=>{console.warn(`[pm] 同步项目管理数据目录失败`,e)})}let L=(0,C.useMemo)(()=>s.filter(e=>t[e.id]).length,[t]),R=T.trim().toLowerCase(),z=(0,C.useMemo)(()=>Q.map(e=>({...e,items:e.items.filter(e=>{let n=!R||e.name.toLowerCase().includes(R)||e.id.toLowerCase().includes(R)||e.description.toLowerCase().includes(R),r=D===`all`||(D===`on`?t[e.id]:!t[e.id]);return n&&r})})).filter(e=>e.items.length>0),[t,R,D]);return(0,Y.jsx)(`div`,{className:`tw-plugins-page overflow-y-auto ${e?`h-full min-h-0 flex-1`:`min-h-screen`}`,children:(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-[1080px] ${e?`px-6 py-5`:`px-6 py-7`}`,children:[(0,Y.jsxs)(`header`,{className:`tw-plugins-head`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`text-[20px] font-semibold tracking-tight text-stone-900`,children:`我的插件`}),(0,Y.jsxs)(`p`,{className:`mt-1.5 text-[13px] leading-6 text-stone-500`,children:[`按用途分组的扩展能力,开关保存在本机;会话 / 全局内置能力在`,(0,Y.jsx)(`span`,{className:`mx-1 rounded bg-stone-100 px-1 py-0.5 text-[12px] text-stone-600`,children:`设置 → 内置插件`}),`里查看。`]})]}),(0,Y.jsxs)(`div`,{className:`tw-plugins-stats`,"aria-label":`插件概览`,children:[(0,Y.jsxs)(`div`,{className:`tw-plugins-stat`,children:[(0,Y.jsx)(`span`,{className:`tw-plugins-stat-num`,children:s.length}),(0,Y.jsx)(`span`,{className:`tw-plugins-stat-label`,children:`个插件`})]}),(0,Y.jsxs)(`div`,{className:`tw-plugins-stat`,children:[(0,Y.jsx)(`span`,{className:`tw-plugins-stat-num is-on`,children:L}),(0,Y.jsx)(`span`,{className:`tw-plugins-stat-label`,children:`已启用`})]}),(0,Y.jsxs)(`div`,{className:`tw-plugins-stat`,children:[(0,Y.jsx)(`span`,{className:`tw-plugins-stat-num`,children:Q.length}),(0,Y.jsx)(`span`,{className:`tw-plugins-stat-label`,children:`个分类`})]})]})]}),(0,Y.jsxs)(`div`,{className:`tw-plugins-toolbar`,children:[(0,Y.jsxs)(`label`,{className:`relative block w-full max-w-72`,children:[(0,Y.jsxs)(`svg`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-stone-400`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:[(0,Y.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,Y.jsx)(`path`,{d:`m20 20-3.5-3.5`})]}),(0,Y.jsx)(`input`,{value:T,onChange:e=>E(e.target.value),placeholder:`搜索插件名 / 作用`,className:`h-9 w-full rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-[13px] text-stone-800 outline-none transition-colors placeholder:text-stone-400 focus:border-[#4176e6]`})]}),(0,Y.jsx)(`div`,{className:`tw-plugins-pills`,role:`group`,"aria-label":`按状态筛选`,children:ne.map(e=>(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":D===e.id,onClick:()=>O(e.id),children:e.label},e.id))})]}),(0,Y.jsxs)(`div`,{className:`mt-4 space-y-6`,children:[z.map(e=>{let n=!!M[e.category],r=e.items.filter(e=>t[e.id]).length;return(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":!n,onClick:()=>N(t=>({...t,[e.category]:!n})),className:`mb-2.5 flex w-full items-center gap-2 text-left`,children:[(0,Y.jsx)($,{className:`h-3.5 w-3.5 shrink-0 text-stone-400 transition-transform ${n?`-rotate-90`:``}`}),(0,Y.jsx)(`span`,{className:`text-[13px] font-semibold text-stone-800`,children:e.category}),(0,Y.jsxs)(`span`,{className:`rounded-full bg-stone-100 px-1.5 py-0.5 text-[11px] tabular-nums text-stone-500`,children:[r,`/`,e.items.length]}),(0,Y.jsx)(`span`,{className:`ml-1 h-px flex-1 bg-stone-200/70`,"aria-hidden":`true`})]}),n?null:(0,Y.jsx)(`ul`,{className:`tw-anim-list tw-plugin-grid`,children:e.items.map(e=>{let n=t[e.id],r=F(e.id),i=k===`ext:${e.id}`;return(0,Y.jsx)(`li`,{className:`relative z-0 min-w-0 overflow-visible hover:z-40 focus-within:z-40${i?` z-40`:``}`,children:(0,Y.jsx)(ie,{open:i,onToggleOpen:()=>j(i?null:`ext:${e.id}`),title:e.name,subtitle:e.description,badge:(0,Y.jsxs)(`span`,{className:`rounded border border-stone-200 px-1.5 py-0.5 text-[11px] tabular-nums text-stone-400`,children:[`v`,e.version]}),trailing:e.alwaysOn?(0,Y.jsx)(`span`,{className:`rounded border border-stone-200 px-1.5 py-0.5 text-[11px] text-stone-500`,children:`内置`}):(0,Y.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n,"aria-label":`${n?`关闭`:`打开`} ${e.name}`,onClick:()=>I(e.id),className:`tw-toggle`,children:(0,Y.jsx)(`span`,{className:`tw-toggle-knob`})}),fullName:`@lh-plugins/${e.id}`,configLabel:e.alwaysOn?`内置常开`:n?`已启用`:`未启用`,runLabel:n&&r.available===!0?`运行中`:`已停用`,extra:r.detail})},e.id)})})]},e.category)}),z.length?null:(0,Y.jsxs)(`div`,{className:`rounded-xl border border-dashed border-stone-200 bg-white/60 px-4 py-12 text-center`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-stone-600`,children:`没有匹配的插件`}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-stone-400`,children:`换个关键词,或把状态筛选切回「全部」。`})]})]})]})})}function ie(e){let{open:t,onToggleOpen:n,title:r,subtitle:i,badge:a,trailing:o,fullName:s,configLabel:c,runLabel:l,extra:d}=e;return(0,Y.jsxs)(`div`,{className:`tw-plugin-card group/card relative z-0 self-start w-full overflow-visible rounded-xl border bg-white transition-colors hover:z-40 focus-within:z-40 ${t?`z-40 border-[#4176e6]/50 shadow-sm`:`border-stone-200 hover:border-stone-300`}`,children:[(0,Y.jsxs)(`div`,{className:`relative flex h-17 items-start gap-3 overflow-visible px-4 py-3`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:n,className:`relative h-full min-w-0 flex-1 overflow-visible text-left outline-none focus:outline-none`,"aria-expanded":t,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`min-w-0 truncate text-[14px] font-medium text-stone-900`,children:r}),a,(0,Y.jsx)($,{className:`h-3.5 w-3.5 shrink-0 text-stone-400 transition-transform duration-300 ease-out ${t?`rotate-180`:``}`})]}),(0,Y.jsx)(u,{text:i,className:`mt-1 block min-w-0 truncate text-[13px] leading-5 text-stone-500`,disabled:t})]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 self-start pt-0.5`,children:o})]}),(0,Y.jsx)(`div`,{className:`tw-collapse ${t?`is-open`:``}`,"aria-hidden":!t,children:(0,Y.jsx)(`div`,{className:`tw-collapse-inner`,children:(0,Y.jsx)(`div`,{className:`border-t border-stone-100 px-4 pb-3 pt-0`,children:(0,Y.jsxs)(`dl`,{className:`mt-2.5 space-y-1.5 text-[13px]`,children:[(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`完整名称`}),(0,Y.jsx)(`dd`,{className:`min-w-0 break-all font-mono text-[12px] text-stone-700`,children:s})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`配置状态`}),(0,Y.jsx)(`dd`,{className:`text-stone-700`,children:c})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`运行状态`}),(0,Y.jsx)(`dd`,{className:l===`运行中`?`text-emerald-600`:`text-stone-500`,children:l})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`简介`}),(0,Y.jsx)(`dd`,{className:`text-[12px] leading-5 text-stone-500`,children:i})]}),d?(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`说明`}),(0,Y.jsx)(`dd`,{className:`text-[12px] leading-5 text-stone-500`,children:d})]}):null]})})})})]})}function $({className:e}){return(0,Y.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,className:e,"aria-hidden":!0,children:(0,Y.jsx)(`path`,{d:`m6 9 6 6 6-6`})})}export{W as _,R as a,M as b,J as c,A as d,P as f,H as g,K as h,I as i,V as l,U as m,E as n,B as o,F as p,D as r,z as s,re as t,j as u,L as v,q as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{t as default}from"./PluginsPage.DBRfSxtq.js";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,n as r,r as i,t as a}from"./dialog.DZHZCe_T.js";import{t as o}from"./jsx-runtime.DUg_B_vD.js";import{t as s}from"./OverflowHint.pvo2Xc8R.js";function c(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var l=c();function u(e){l=e}var d={exec:()=>null};function f(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(p.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var p={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`)},ee=/^(?:[ \t]*(?:\n|$))+/,te=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,m=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,h=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,g=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,_=/(?:[*+-]|\d{1,9}[.)])/,v=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,y=f(v).replace(/bull/g,_).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),ne=f(v).replace(/bull/g,_).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),b=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,x=/^[^\n]+/,S=/(?!\s*\])(?:\\.|[^\[\]\\])+/,re=f(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,S).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),C=f(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,_).getRegex(),w=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,ie=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ae=f(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,ie).replace(`tag`,w).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),T=f(b).replace(`hr`,h).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,w).getRegex(),oe={blockquote:f(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,T).getRegex(),code:te,def:re,fences:m,heading:g,hr:h,html:ae,lheading:y,list:C,newline:ee,paragraph:T,table:d,text:x},se=f(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,h).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,w).getRegex(),ce={...oe,lheading:ne,table:se,paragraph:f(b).replace(`hr`,h).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,se).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,w).getRegex()},le={...oe,html:f(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,ie).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:d,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:f(b).replace(`hr`,h).replace(`heading`,` *#{1,6} *[^
|
|
2
|
+
]`).replace(`lheading`,y).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},ue=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,de=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,fe=/^( {2,}|\\)\n(?!\s*$)/,pe=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,me=/[\p{P}\p{S}]/u,he=/[\s\p{P}\p{S}]/u,E=/[^\s\p{P}\p{S}]/u,ge=f(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,he).getRegex(),_e=/(?!~)[\p{P}\p{S}]/u,ve=/(?!~)[\s\p{P}\p{S}]/u,ye=/(?:[^\s\p{P}\p{S}]|~)/u,be=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,xe=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Se=f(xe,`u`).replace(/punct/g,me).getRegex(),Ce=f(xe,`u`).replace(/punct/g,_e).getRegex(),we=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,D=f(we,`gu`).replace(/notPunctSpace/g,E).replace(/punctSpace/g,he).replace(/punct/g,me).getRegex(),Te=f(we,`gu`).replace(/notPunctSpace/g,ye).replace(/punctSpace/g,ve).replace(/punct/g,_e).getRegex(),O=f(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,E).replace(/punctSpace/g,he).replace(/punct/g,me).getRegex(),Ee=f(/\\(punct)/,`gu`).replace(/punct/g,me).getRegex(),k=f(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),De=f(ie).replace(`(?:-->|$)`,`-->`).getRegex(),Oe=f(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,De).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),A=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ke=f(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace(`label`,A).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ae=f(/^!?\[(label)\]\[(ref)\]/).replace(`label`,A).replace(`ref`,S).getRegex(),je=f(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,S).getRegex(),Me={_backpedal:d,anyPunctuation:Ee,autolink:k,blockSkip:be,br:fe,code:de,del:d,emStrongLDelim:Se,emStrongRDelimAst:D,emStrongRDelimUnd:O,escape:ue,link:ke,nolink:je,punctuation:ge,reflink:Ae,reflinkSearch:f(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Ae).replace(`nolink`,je).getRegex(),tag:Oe,text:pe,url:d},j={...Me,link:f(/^!?\[(label)\]\((.*?)\)/).replace(`label`,A).getRegex(),reflink:f(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,A).getRegex()},M={...Me,emStrongRDelimAst:Te,emStrongLDelim:Ce,url:f(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,`i`).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Ne={...M,br:f(fe).replace(`{2,}`,`*`).getRegex(),text:f(M.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Pe={normal:oe,gfm:ce,pedantic:le},Fe={normal:Me,gfm:M,breaks:Ne,pedantic:j},Ie={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Le=e=>Ie[e];function N(e,t){if(t){if(p.escapeTest.test(e))return e.replace(p.escapeReplace,Le)}else if(p.escapeTestNoEncode.test(e))return e.replace(p.escapeReplaceNoEncode,Le);return e}function Re(e){try{e=encodeURI(e).replace(p.percentDecode,`%`)}catch{return null}return e}function ze(e,t){let n=e.replace(p.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(p.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(p.slashPipe,`|`);return n}function Be(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Ve(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function He(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function Ue(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
3
|
+
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
4
|
+
`)}var We=class{options;rules;lexer;constructor(e){this.options=e||l}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:Be(e,`
|
|
5
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Ue(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=Be(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:Be(t[0],`
|
|
6
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Be(t[0],`
|
|
7
|
+
`).split(`
|
|
8
|
+
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
9
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
10
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
11
|
+
${s}`:s,r=r?`${r}
|
|
12
|
+
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
|
|
13
|
+
`+e.join(`
|
|
14
|
+
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
|
|
15
|
+
`+e.join(`
|
|
16
|
+
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
17
|
+
`)}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t[2].split(`
|
|
18
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,e=>` `.repeat(3*e.length)),l=e.split(`
|
|
19
|
+
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
20
|
+
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d);for(;e;){let f=e.split(`
|
|
21
|
+
`,1)[0],p;if(l=f,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),p=l):p=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||t.test(l)||n.test(l))break;if(p.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
22
|
+
`+p.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
23
|
+
`+l}!u&&!l.trim()&&(u=!0),r+=f+`
|
|
24
|
+
`,e=e.substring(f.length+1),c=p.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let f=null,p;this.options.gfm&&(f=this.rules.other.listIsTask.exec(s),f&&(p=f[0]!==`[ ] `,s=s.replace(this.rules.other.listReplaceTask,``))),i.items.push({type:`list_item`,raw:r,task:!!f,checked:p,loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=ze(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
25
|
+
`):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(ze(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
26
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=Be(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Ve(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),He(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return He(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(r&&!(r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:`del`,raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},P=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||l,this.options.tokenizer=this.options.tokenizer||new We,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:p,block:Pe.normal,inline:Fe.normal};this.options.pedantic?(t.block=Pe.pedantic,t.inline=Fe.pedantic):this.options.gfm&&(t.block=Pe.gfm,t.inline=this.options.breaks?Fe.breaks:Fe.gfm),this.tokenizer.rules=t}static get rules(){return{block:Pe,inline:Fe}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(p.carriageReturn,`
|
|
27
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(p.tabCharGlobal,` `).replace(p.spaceLine,``));e;){let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
|
|
28
|
+
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=`
|
|
29
|
+
`+r.raw,n.text+=`
|
|
30
|
+
`+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if((r=this.tokenizer.fences(e))||(r=this.tokenizer.heading(e))||(r=this.tokenizer.hr(e))||(r=this.tokenizer.blockquote(e))||(r=this.tokenizer.list(e))||(r=this.tokenizer.html(e))){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=`
|
|
31
|
+
`+r.raw,n.text+=`
|
|
32
|
+
`+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});continue}if((r=this.tokenizer.table(e))||(r=this.tokenizer.lheading(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);n&&a?.type===`paragraph`?(a.raw+=`
|
|
33
|
+
`+r.raw,a.text+=`
|
|
34
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length)}else if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=`
|
|
35
|
+
`+r.raw,n.text+=`
|
|
36
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r)}else if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,a=``;for(;e;){i||(a=``),i=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if((r=this.tokenizer.escape(e))||(r=this.tokenizer.tag(e))||(r=this.tokenizer.link(e))){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if((r=this.tokenizer.emStrong(e,n,a))||(r=this.tokenizer.codespan(e))||(r=this.tokenizer.br(e))||(r=this.tokenizer.del(e))||(r=this.tokenizer.autolink(e))||!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let o=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(o)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(a=r.raw.slice(-1)),i=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r)}else if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return t}},F=class{options;parser;constructor(e){this.options=e||l}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(p.notSpaceStart)?.[0],i=e.replace(p.endingNewline,``)+`
|
|
37
|
+
`;return r?`<pre><code class="language-`+N(r)+`">`+(n?i:N(i,!0))+`</code></pre>
|
|
38
|
+
`:`<pre><code>`+(n?i:N(i,!0))+`</code></pre>
|
|
39
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
40
|
+
${this.parser.parse(e)}</blockquote>
|
|
41
|
+
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
42
|
+
`}hr(e){return`<hr>
|
|
43
|
+
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
44
|
+
`+r+`</`+i+`>
|
|
45
|
+
`}listitem(e){let t=``;if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type===`paragraph`?(e.tokens[0].text=n+` `+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type===`text`&&(e.tokens[0].tokens[0].text=n+` `+N(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:`text`,raw:n+` `,text:n+` `,escaped:!0}):t+=n+` `}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
|
|
46
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox">`}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
47
|
+
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
48
|
+
<thead>
|
|
49
|
+
`+t+`</thead>
|
|
50
|
+
`+r+`</table>
|
|
51
|
+
`}tablerow({text:e}){return`<tr>
|
|
52
|
+
${e}</tr>
|
|
53
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
54
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${N(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Re(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+N(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Re(e);if(i===null)return N(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${N(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:N(e.text)}},I=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}},L=class e{options;renderer;textRenderer;constructor(e){this.options=e||l,this.options.renderer=this.options.renderer||new F,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new I}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(t!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`paragraph`,`text`].includes(e.type)){n+=t||``;continue}}let a=i;switch(a.type){case`space`:n+=this.renderer.space(a);continue;case`hr`:n+=this.renderer.hr(a);continue;case`heading`:n+=this.renderer.heading(a);continue;case`code`:n+=this.renderer.code(a);continue;case`table`:n+=this.renderer.table(a);continue;case`blockquote`:n+=this.renderer.blockquote(a);continue;case`list`:n+=this.renderer.list(a);continue;case`html`:n+=this.renderer.html(a);continue;case`paragraph`:n+=this.renderer.paragraph(a);continue;case`text`:{let i=a,o=this.renderer.text(i);for(;r+1<e.length&&e[r+1].type===`text`;)i=e[++r],o+=`
|
|
55
|
+
`+this.renderer.text(i);n+=t?this.renderer.paragraph({type:`paragraph`,raw:o,text:o,tokens:[{type:`text`,raw:o,text:o,escaped:!0}]}):o;continue}default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}parseInline(e,t=this.renderer){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Ge=class{options;block;constructor(e){this.options=e||l}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?P.lex:P.lexInline}provideParser(){return this.block?L.parse:L.parseInline}},Ke=class{defaults=c();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=L;Renderer=F;TextRenderer=I;Lexer=P;Tokenizer=We;Hooks=Ge;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new F(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new We(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Ge;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=Ge.passThroughHooks.has(n)?e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then(e=>a.call(t,e));let n=i.call(t,e);return a.call(t,n)}:(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return P.lex(e,t??this.defaults)}parser(e,t){return L.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(t==null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));i.hooks&&(i.hooks.options=i,i.hooks.block=e);let o=i.hooks?i.hooks.provideLexer():e?P.lex:P.lexInline,s=i.hooks?i.hooks.provideParser():e?L.parse:L.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then(e=>o(e,i)).then(e=>i.hooks?i.hooks.processAllTokens(e):e).then(e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then(()=>e):e).then(e=>s(e,i)).then(e=>i.hooks?i.hooks.postprocess(e):e).catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let e=o(t,i);i.hooks&&(e=i.hooks.processAllTokens(e)),i.walkTokens&&this.walkTokens(e,i.walkTokens);let n=s(e,i);return i.hooks&&(n=i.hooks.postprocess(n)),n}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
56
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+N(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},R=new Ke;function z(e,t){return R.parse(e,t)}z.options=z.setOptions=function(e){return R.setOptions(e),z.defaults=R.defaults,u(z.defaults),z},z.getDefaults=c,z.defaults=l,z.use=function(...e){return R.use(...e),z.defaults=R.defaults,u(z.defaults),z},z.walkTokens=function(e,t){return R.walkTokens(e,t)},z.parseInline=R.parseInline,z.Parser=L,z.parser=L.parse,z.Renderer=F,z.TextRenderer=I,z.Lexer=P,z.lexer=P.lex,z.Tokenizer=We,z.Hooks=Ge,z.parse=z,z.options,z.setOptions,z.use,z.walkTokens,z.parseInline,L.parse,P.lex;function qe(e,t){this.v=e,this.k=t}function Je(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function B(e){if(Array.isArray(e))return e}function Ye(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Xe(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
57
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ze(e,t){return B(e)||Ye(e,t)||Qe(e,t)||Xe()}function Qe(e,t){if(e){if(typeof e==`string`)return Je(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Je(e,t):void 0}}function $e(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof qe;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}$e.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},$e.prototype.next=function(e){return this._invoke(`next`,e)},$e.prototype.throw=function(e){return this._invoke(`throw`,e)},$e.prototype.return=function(e){return this._invoke(`return`,e)};var et=Object.entries,tt=Object.setPrototypeOf,nt=Object.isFrozen,rt=Object.getPrototypeOf,it=Object.getOwnPropertyDescriptor,V=Object.freeze,H=Object.seal,at=Object.create,ot=typeof Reflect<`u`&&Reflect,st=ot.apply,U=ot.construct;V||=function(e){return e},H||=function(e){return e},st||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},U||=function(e){return new e(...[...arguments].slice(1))};var W=q(Array.prototype.forEach);Array.prototype.indexOf;var ct=q(Array.prototype.lastIndexOf),lt=q(Array.prototype.pop),ut=q(Array.prototype.push),dt=q(Array.prototype.slice),ft=q(Array.prototype.splice),pt=Array.isArray,mt=kt(Set),ht=q(Set.prototype.add),gt=q(Set.prototype.has),_t=q(String.prototype.toLowerCase),vt=q(String.prototype.toString),yt=q(String.prototype.match),bt=q(String.prototype.replace),xt=q(String.prototype.indexOf),St=q(String.prototype.trim),Ct=q(Number.prototype.toString),wt=q(Boolean.prototype.toString),Tt=typeof BigInt>`u`?null:q(BigInt.prototype.toString),Et=typeof Symbol>`u`?null:q(Symbol.prototype.toString),G=q(Object.prototype.hasOwnProperty),Dt=q(Object.prototype.toString),K=q(RegExp.prototype.test),Ot=kt(TypeError);function q(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return st(e,t,n)}}function kt(e){return function(){return U(e,[...arguments])}}function J(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:_t;if(tt&&tt(e,null),!pt(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(nt(t)||(t[r]=e),i=e)}e[i]=!0}return e}function At(e){for(let t=0;t<e.length;t++)G(e,t)||(e[t]=null);return e}function Y(e){let t=at(null);for(let r of et(e)){var n=Ze(r,2);let i=n[0],a=n[1];G(e,i)&&(t[i]=pt(a)?At(a):a&&typeof a==`object`&&a.constructor===Object?Y(a):a)}return t}function jt(e){switch(typeof e){case`string`:return e;case`number`:return Ct(e);case`boolean`:return wt(e);case`bigint`:return Tt?Tt(e):`0`;case`symbol`:return Et?Et(e):`Symbol()`;case`undefined`:return Dt(e);case`function`:case`object`:{if(e===null)return Dt(e);let t=e,n=X(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Dt(e)}return Dt(e)}default:return Dt(e)}}function X(e,t){for(;e!==null;){let n=it(e,t);if(n){if(n.get)return q(n.get);if(typeof n.value==`function`)return q(n.value)}e=rt(e)}function n(){return null}return n}function Mt(e,t){for(;e!==null;){let n=it(e,t);if(n)return n.get?q(n.get):null;e=rt(e)}return null}function Nt(e){try{return K(e,``),!0}catch{return!1}}var Pt=V(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Ft=V(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),It=V([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Lt=V([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Rt=V(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),zt=V([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Bt=V([`#text`]),Vt=V(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Ht=V(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),Ut=V(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Wt=V([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Gt=H(/{{[\w\W]*|^[\w\W]*}}/g),Kt=H(/<%[\w\W]*|^[\w\W]*%>/g),qt=H(/\${[\w\W]*/g),Jt=H(/^data-[\-\w.\u00B7-\uFFFF]+$/),Yt=H(/^aria-[\-\w]+$/),Xt=H(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Zt=H(/^(?:\w+script|data):/i),Qt=H(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),$t=H(/^html$/i),en=H(/^[a-z][.\w]*(-[.\w]+)+$/i),tn=H(/<[/\w!]/g),nn=H(/<[/\w]/g),rn=H(/<\/no(script|embed|frames)/i),an=H(/\/>/i),Z={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},on=V(J({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),sn=function(){return typeof window>`u`?null:window},cn=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},ln=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},un=function(e,t,n,r){return G(e,t)&&pt(e[t])?J(r.base?Y(r.base):{},e[t],r.transform):n},dn=function(e,t,n){let r=G(e,t)?e[t]:void 0;return r&&typeof r==`object`?Y(r):n()};function fn(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:sn(),t=e=>fn(e);if(t.version=`3.4.17`,t.removed=[],!e||!e.document||e.document.nodeType!==Z.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=X(d,`cloneNode`),p=X(d,`remove`),ee=X(d,`removeAttributeNode`),te=X(d,`nextSibling`),m=X(d,`childNodes`),h=X(d,`parentNode`),g=X(d,`shadowRoot`),_=X(d,`attributes`),v=o&&o.prototype?X(o.prototype,`nodeType`):null,y=o&&o.prototype?X(o.prototype,`nodeName`):null,ne=o&&o.prototype?X(o.prototype,`ownerDocument`):null,b=function(e){return v?v(e):e.nodeType},x=function(e){return y?y(e):e.nodeName},S=Mt(d,`namespaceURI`),re=function(e){return S?S(e):e.namespaceURI};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let C,w=``,ie,ae=!1,T=0,oe=function(){if(T>0)throw Ot(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},se=function(e){oe(),T++;try{return C.createHTML(e)}finally{T--}},ce=function(e){oe(),T++;try{return C.createScriptURL(e)}finally{T--}},le=function(){return ae||=(ie=cn(u,i),!0),ie},ue=n,de=ue.implementation,fe=ue.createNodeIterator,pe=ue.createDocumentFragment,me=ue.getElementsByTagName,he=r.importNode,E=ln();t.isSupported=typeof et==`function`&&typeof h==`function`&&de&&de.createHTMLDocument!==void 0;let ge=Gt,_e=Kt,ve=qt,ye=Jt,be=Yt,xe=Zt,Se=Qt,Ce=en,we=Xt,D=null,Te=J({},[...Pt,...Ft,...It,...Rt,...Bt]),O=null,Ee=J({},[...Vt,...Ht,...Ut,...Wt]),k=Object.seal(at(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),De=null,Oe=null,A=Object.seal(at(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ke=!0,Ae=!0,je=!1,Me=!0,j=!1,M=!0,Ne=!1,Pe=!1,Fe=null,Ie=null,Le=!1,N=!1,Re=!1,ze=!1,Be=!0,Ve=!1,He=`user-content-`,Ue=!0,We=!1,P=null,F={},I=null,L=J({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Ge=null,Ke=J({},[`audio`,`video`,`img`,`source`,`image`,`track`]),R=null,z=J({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),qe=`http://www.w3.org/1998/Math/MathML`,Je=`http://www.w3.org/2000/svg`,B=`http://www.w3.org/1999/xhtml`,Ye=B,Xe=!1,Ze=null,Qe=J({},[qe,Je,B],vt),$e=V([`mi`,`mo`,`mn`,`ms`,`mtext`]),tt=J({},$e),nt=V([`annotation-xml`]),rt=J({},nt),it=J({},[`title`,`style`,`font`,`a`,`script`]),ot=null,st=[`application/xhtml+xml`,`text/html`],U=null,Ct=null,wt=n.createElement(`form`),Tt=function(e){return e instanceof RegExp||e instanceof Function},Et=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ct&&Ct===e)return;(!e||typeof e!=`object`)&&(e={}),e=Y(e),ot=st.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,U=ot===`application/xhtml+xml`?vt:_t,D=un(e,`ALLOWED_TAGS`,Te,{transform:U}),O=un(e,`ALLOWED_ATTR`,Ee,{transform:U}),Ze=un(e,`ALLOWED_NAMESPACES`,Qe,{transform:vt}),R=un(e,`ADD_URI_SAFE_ATTR`,z,{transform:U,base:z}),Ge=un(e,`ADD_DATA_URI_TAGS`,Ke,{transform:U,base:Ke}),I=un(e,`FORBID_CONTENTS`,L,{transform:U}),De=un(e,`FORBID_TAGS`,Y({}),{transform:U}),Oe=un(e,`FORBID_ATTR`,Y({}),{transform:U}),F=G(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Y(e.USE_PROFILES):e.USE_PROFILES:!1,ke=e.ALLOW_ARIA_ATTR!==!1,Ae=e.ALLOW_DATA_ATTR!==!1,je=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Me=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,j=e.SAFE_FOR_TEMPLATES||!1,M=e.SAFE_FOR_XML!==!1,Ne=e.WHOLE_DOCUMENT||!1,N=e.RETURN_DOM||!1,Re=e.RETURN_DOM_FRAGMENT||!1,ze=e.RETURN_TRUSTED_TYPE||!1,Le=e.FORCE_BODY||!1,Be=e.SANITIZE_DOM!==!1,Ve=e.SANITIZE_NAMED_PROPS||!1,Ue=e.KEEP_CONTENT!==!1,We=e.IN_PLACE||!1,we=Nt(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Xt,Ye=typeof e.NAMESPACE==`string`?e.NAMESPACE:B,tt=dn(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>J({},$e)),rt=dn(e,`HTML_INTEGRATION_POINTS`,()=>J({},nt));let t=dn(e,`CUSTOM_ELEMENT_HANDLING`,()=>at(null));if(k=at(null),G(t,`tagNameCheck`)&&Tt(t.tagNameCheck)&&(k.tagNameCheck=t.tagNameCheck),G(t,`attributeNameCheck`)&&Tt(t.attributeNameCheck)&&(k.attributeNameCheck=t.attributeNameCheck),G(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(k.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),H(k),j&&(Ae=!1),Re&&(N=!0),F&&(D=J({},Bt),O=at(null),F.html===!0&&(J(D,Pt),J(O,Vt)),F.svg===!0&&(J(D,Ft),J(O,Ht),J(O,Wt)),F.svgFilters===!0&&(J(D,It),J(O,Ht),J(O,Wt)),F.mathMl===!0&&(J(D,Rt),J(O,Ut),J(O,Wt))),A.tagCheck=null,A.attributeCheck=null,G(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?A.tagCheck=e.ADD_TAGS:pt(e.ADD_TAGS)&&(D===Te&&(D=Y(D)),J(D,e.ADD_TAGS,U))),G(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?A.attributeCheck=e.ADD_ATTR:pt(e.ADD_ATTR)&&(O===Ee&&(O=Y(O)),J(O,e.ADD_ATTR,U))),G(e,`ADD_FORBID_CONTENTS`)&&pt(e.ADD_FORBID_CONTENTS)&&(I===L&&(I=Y(I)),J(I,e.ADD_FORBID_CONTENTS,U)),Ue&&(D[`#text`]=!0),Ne&&J(D,[`html`,`head`,`body`]),D.table&&(J(D,[`tbody`]),delete De.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Ot(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Ot(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=C;C=e.TRUSTED_TYPES_POLICY;try{w=se(``)}catch(e){throw C=t,e}}else e.TRUSTED_TYPES_POLICY===null?(C=void 0,w=``):(C===void 0&&(C=le()),C&&typeof w==`string`&&(w=se(``)));V&&V(e),Ct=e},Dt=J({},[...Ft,...It,...Lt]),q=J({},[...Rt,...zt]),kt=function(e,t,n){return t.namespaceURI===B?e===`svg`:t.namespaceURI===qe?e===`svg`&&(n===`annotation-xml`||tt[n]):!!Dt[e]},At=function(e,t,n){return t.namespaceURI===B?e===`math`:t.namespaceURI===Je?e===`math`&&rt[n]:!!q[e]},pn=function(e,t,n){return t.namespaceURI===Je&&!rt[n]||t.namespaceURI===qe&&!tt[n]?!1:!q[e]&&(it[e]||!Dt[e])},mn=function(e){let t=re(e),n=_t(x(e)),r=h(e),i,a;return r&&b(r)===Z.element?(i={namespaceURI:re(r)},a=_t(x(r))):(i={namespaceURI:Ye},a=`template`),Ze[t]?t===Je?kt(n,i,a):t===qe?At(n,i,a):t===B?pn(n,i,a):!!(ot===`application/xhtml+xml`&&Ze[t]):!1},hn=function(e){ut(t.removed,{element:e});try{h(e).removeChild(e)}catch{if(p(e),!h(e))throw Ot(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},gn=function(e,t,n){try{ee(e,t)}catch{try{e.removeAttribute(n)}catch{}}},_n=function(e){bn(e);let t=m(e);t&&W(dt(t),e=>{try{p(e)}catch{}});let n=b(e)===Z.element?_(e):null;if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&gn(e,r,i)}},vn=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}ut(t.removed,{attribute:r||null,from:n});try{r?ee(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(N||Re)try{hn(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},yn=function(e){let t=_(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||O[U(i)]||gn(e,r,i)}},Q=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=[e];for(;r.length>0;){let e=r.pop();if(t(e)===!1)continue;if(n&&b(e)===Z.element){let t=g(e);Fn(t)&&r.push(t)}let i=m(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},bn=function(e){Q(e,e=>{b(e)===Z.element&&yn(e)})},xn=function(e){let t=[];return Q(e,e=>{t.push(e)},!0),t},Sn=function(e,t){let n=mt();W(xn(e),e=>{b(e)===Z.element&&ht(n,e)}),W(t,e=>{b(e)===Z.element&&!gt(n,e)&&yn(e)})},Cn=function(e,n){let r=!1;return W(t.removed,t=>{t.element&&(r||=t.element===e,bn(t.element))}),Sn(e,n),r},wn=function(e,t){let n=P,r=null,i=()=>(r||(r=mt(),W(t,e=>{ht(r,e)})),r);for(let t=0;;t++){let r=xn(e),a=[e],o=!1;if(W(r,e=>{b(e)===Z.documentFragment?ut(a,e):!o&&!gt(n,e)&&(o=gt(i(),e))}),!o)return;if(t>=8)throw Ot(`the tree kept changing during in-place sanitization; refusing to return it`);W(a,(t,n)=>{Tn(t,n>0,e,i())})}},Tn=function(e,t,n,r){let i=An(e),a;for(;a=i.nextNode();)gt(r,a)&&!gt(P,a)&&(t&&$(E.uponSanitizeShadowNode,a,null),Hn(a,n),Yn(a,n),Fn(a.content)&&Xn(a.content))},En=function(e){P&&ht(P,e)},Dn=function(e,t){return M?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},On=function(e){M&&Q(e,e=>{let t=b(e);if(t===Z.processingInstruction||t===Z.comment&&K(nn,e.data)){try{p(e)}catch{}return!1}if(t===Z.element){let t=e,n=U(x(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Dn(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},kn=function(e){let t=null,r=null;if(Le)e=`<remove></remove>`+e;else{let t=yt(e,/^[\r\n\t ]+/);r=t&&t[0]}ot===`application/xhtml+xml`&&Ye===B&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=C?se(e):e;if(Ye===B)try{t=new l().parseFromString(i,ot)}catch{}if(!t||!t.documentElement){t=de.createDocument(Ye,`template`,null);try{t.documentElement.innerHTML=Xe?w:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ye===B?me.call(t,Ne?`html`:`body`)[0]:Ne?t.documentElement:a},An=function(e){let t=ne?ne(e):e.ownerDocument;return fe.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},jn=function(e){return e=bt(e,ge,` `),e=bt(e,_e,` `),e=bt(e,ve,` `),e},Mn=function(e){Nn(e);let t=e.querySelectorAll?.call(e,`template`);t&&W(t,e=>{Fn(e.content)&&Mn(e.content)})},Nn=function(e){e.normalize();let t=ne?ne(e):e.ownerDocument,n=fe.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=jn(r.data),r=n.nextNode()},Pn=function(e){let t=y?y(e):null;return typeof t!=`string`||U(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==_(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==v(e)||e.childNodes!==m(e)},Fn=function(e){if(!v||typeof e!=`object`||!e)return!1;try{return v(e)===Z.documentFragment}catch{return!1}},In=function(e){if(!v||typeof e!=`object`||!e)return!1;try{return typeof v(e)==`number`}catch{return!1}};function $(e,n,r){e.length!==0&&W(e,e=>{e.call(t,n,r,Ct)})}let Ln=function(e,t){return!!(M&&e.hasChildNodes()&&!In(e.firstElementChild)&&K(tn,e.textContent)&&K(tn,e.innerHTML)||M&&on[t]&&b(e)===Z.element&&re(e)===B&&(In(e.firstElementChild)||typeof e.textContent==`string`&&K(tn,e.textContent))||e.nodeType===Z.processingInstruction||M&&e.nodeType===Z.comment&&K(nn,e.data))},Rn=function(e,t){return e instanceof RegExp?K(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},zn=function(e,t,n){if(!De[t]&&Gn(t)&&Rn(k.tagNameCheck,t))return!1;if(Ue&&!I[t]&&!I[_t(t)]){let t=h(e),r=m(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,te(e))}}}return hn(e),!0},Bn=function(e,t,n,r){return e.length===0?t:t===n||t===r?Y(t):t},Vn=function(e,t){return e===t||h(e)!==null?!1:(We&&bn(e),!0)},Hn=function(e,n){if(En(e),$(E.beforeSanitizeElements,e,null),Vn(e,n))return!0;if(Pn(e))return hn(e),!0;let r=U(x(e));if(D=Bn(E.uponSanitizeElement,D,Te,Fe),$(E.uponSanitizeElement,e,{tagName:r,allowedTags:D}),Vn(e,n))return!0;if(Ln(e,r))return hn(e),!0;if(De[r]||!(A.tagCheck instanceof Function&&A.tagCheck(r))&&!D[r]){let t=zn(e,r,n);return t===!1&&($(E.afterSanitizeElements,e,null),Vn(e,n))?!0:t}if(b(e)===Z.element&&!mn(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&K(rn,e.innerHTML))return hn(e),!0;if(j&&e.nodeType===Z.text){let n=jn(e.textContent);e.textContent!==n&&(ut(t.removed,{element:e.cloneNode()}),e.textContent=n)}return $(E.afterSanitizeElements,e,null),Vn(e,n)},Un=function(e,t,r){if(Oe[t]||Dn(t,e)||Be&&(t===`id`||t===`name`)&&(r in n||r in wt))return!1;let i=O[t]||A.attributeCheck instanceof Function&&A.attributeCheck(t,e);return Ae&&K(ye,t)||ke&&K(be,t)?!0:i?R[t]||K(we,bt(r,Se,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&xt(r,`data:`)===0&&Ge[e]||je&&!K(xe,bt(r,Se,``))?!0:!r:Gn(e)&&Rn(k.tagNameCheck,e)&&Rn(k.attributeNameCheck,t,e)||t===`is`&&k.allowCustomizedBuiltInElements&&Rn(k.tagNameCheck,r)},Wn=J({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Gn=function(e){return!Wn[_t(e)]&&K(Ce,e)},Kn=function(e,t,n,r){if(C&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return se(r);case`TrustedScriptURL`:return ce(r)}return r},qn=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Pn(e)||(hn(e),!1)}catch{return vn(t,e),!1}},Jn=function(e,t){return M&&K(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:_t(e)===`attributename`&&yt(t,`href`)!==null},Yn=function(e,n){if($(E.beforeSanitizeAttributes,e,null),Vn(e,n))return;let r=e.attributes;if(!r||Pn(e))return;O=Bn(E.uponSanitizeAttribute,O,Ee,Ie);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:O,forceKeepAttr:void 0},a=r.length,o=U(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=U(s),d=l,f=s===`value`?d:St(d),p=!1;i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,$(E.uponSanitizeAttribute,e,i),f=i.attrValue,Ve&&(u===`id`||u===`name`)&&xt(f,He)!==0&&(vn(s,e,n),f=He+f,p=!0),Jn(s,f)?vn(s,e,n):i.forceKeepAttr||(i.keepAttr?!Me&&K(an,f)?vn(s,e,n):(j&&(f=jn(f)),Un(o,u,f)?(f=Kn(o,u,c,f),f!==d&&qn(e,s,c,f)&&p&<(t.removed)):vn(s,e,n)):vn(s,e,n))}$(E.afterSanitizeAttributes,e,null),Vn(e,n)},Xn=function(e){let t=null,n=An(e);for($(E.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if($(E.uponSanitizeShadowNode,t,null),Hn(t,e),Yn(t,e),Fn(t.content)&&Xn(t.content),b(t)===Z.element){let e=g(t);Fn(e)&&(Zn(e),Xn(e))}j&&Nn(e),$(E.afterSanitizeShadowDOM,e,null)},Zn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Xn(e.shadow);continue}let n=e.node,r=b(n)===Z.element,i=m(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=y?y(n):null;if(typeof e==`string`&&U(e)===`template`){let e=n.content;Fn(e)&&t.push({node:e,shadow:null})}}if(r){let e=g(n);Fn(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Xe=!e,Xe&&(e=`<!-->`),typeof e!=`string`&&!In(e)&&(e=jt(e),typeof e!=`string`))throw Ot(`dirty is not a string, aborting`);if(!t.isSupported)return e;Pe?(D=Fe,O=Ie):Et(n),(E.uponSanitizeElement.length>0||E.uponSanitizeAttribute.length>0)&&(D=Y(D)),E.uponSanitizeAttribute.length>0&&(O=Y(O)),t.removed=[];let c=We&&typeof e!=`string`&&In(e),l=[],u=P;if(c){On(e);let t=x(e);if(typeof t==`string`){let n=U(t);if(!D[n]||De[n])throw _n(e),Ot(`root node is forbidden and cannot be sanitized in-place`)}if(Pn(e))throw _n(e),Ot(`root node is clobbered and cannot be sanitized in-place`);l=xn(e),P=mt()}else if(In(e))i=kn(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===Z.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Zn(i);else{if(!N&&!j&&!Ne&&e.indexOf(`<`)===-1)return C&&ze?se(e):e;if(i=kn(e),!i)return N?null:ze?w:``}i&&Le&&hn(i.firstChild);let d=c?e:i;try{c&&Zn(e);let t=An(d);for(;o=t.nextNode();)Hn(o,d),Yn(o,d),Fn(o.content)&&Xn(o.content);c&&wn(e,l)}catch(t){throw c&&(_n(e),Cn(e,l)),t}finally{P=u}if(c){if(Cn(e,l))throw Ot(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return j&&Mn(e),e}if(N){if(j&&Mn(i),Re)for(s=pe.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(O.shadowroot||O.shadowrootmode)&&(s=he.call(r,s,!0)),s}let f=Ne?i.outerHTML:i.innerHTML;return Ne&&D[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&K($t,i.ownerDocument.doctype.name)&&(f=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
58
|
+
`+f),j&&(f=jn(f)),C&&ze?se(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Et(e),Pe=!0,Fe=D,Ie=O},t.clearConfig=function(){Ct=null,Pe=!1,Fe=null,Ie=null,C=ie,w=``},t.isValidAttribute=function(e,t,n){Ct||Et({});let r=U(e),i=U(t);return typeof n==`string`&&(Jn(t,n)||!Me&&K(an,n))?!1:Un(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&G(E,e)&&ut(E[e],t)},t.removeHook=function(e,t){if(G(E,e)){if(t!==void 0){let n=ct(E[e],t);return n===-1?void 0:ft(E[e],n,1)[0]}return lt(E[e])}},t.removeHooks=function(e){G(E,e)&&(E[e]=[])},t.removeAllHooks=function(){E=ln()},t}var pn=fn();function mn(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}var hn=new Ke({renderer:{code({text:e,lang:t,escaped:n}){return`<div class="code-block"><div class="code-block-head"><span>${mn((t??``).trim().split(/\s+/)[0]||`代码块`)}</span><button type="button" data-copy-code>复制</button></div><pre><code>${n?e:mn(e)}</code></pre></div>`},link(e){return`<a href="${mn(e.href||``)}"${e.title?` title="${mn(e.title)}"`:``} target="_blank" rel="noopener noreferrer">${this.parser.parseInline(e.tokens??[])}</a>`}}});function gn(e){let t=e.cloneNode(!0);return t.querySelectorAll(`br`).forEach(e=>e.replaceWith(`
|
|
59
|
+
`)),(t.textContent||``).replace(/\r\n/g,`
|
|
60
|
+
`).replace(/\n{3,}/g,`
|
|
61
|
+
|
|
62
|
+
`).trim()}function _n(e){if(!e.includes(`<td`)&&!e.includes(`<th`)||typeof DOMParser>`u`)return e;let t=new DOMParser().parseFromString(`<div id="__md_root">${e}</div>`,`text/html`),n=t.getElementById(`__md_root`);return n?(n.querySelectorAll(`table`).forEach(e=>{if(e.parentElement?.classList.contains(`chat-md-table-scroll`))return;let n=t.createElement(`div`);n.className=`chat-md-table-scroll`,e.replaceWith(n),n.appendChild(e)}),n.querySelectorAll(`td, th`).forEach(e=>{if(e.querySelector(`:scope > .chat-md-cell`))return;let n=gn(e);if(!n)return;let r=t.createElement(`span`);for(r.className=`chat-md-cell`,r.setAttribute(`data-hint-fit`,``),r.setAttribute(`data-hint`,n);e.firstChild;)r.appendChild(e.firstChild);e.appendChild(r)}),n.innerHTML):e}function vn(e){let t=hn.parse(e,{async:!1});return _n(pn.sanitize(t,{ADD_ATTR:[`target`,`data-hint`,`data-hint-fit`]}))}var yn=e(t(),1),Q=o(),bn=`bg-[var(--tw-surface-panel)] border-[var(--tw-border)]`,xn=`text-[var(--tw-label-primary)]`,Sn=`text-[var(--tw-label-secondary)]`,Cn=`text-[var(--tw-label-tertiary)]`,wn=`inline-flex h-8 shrink-0 items-center gap-1.5 rounded-lg bg-[#4176e6] px-3 text-sm font-medium text-white transition-colors hover:bg-[#3566d0] disabled:cursor-not-allowed disabled:opacity-50`,Tn=`inline-flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-[var(--tw-border)] px-3 text-sm text-[var(--tw-label-secondary)] transition-colors hover:bg-[var(--tw-session-hover-bg)] disabled:cursor-not-allowed disabled:opacity-50`,En=`h-8 w-full rounded-lg border border-[var(--tw-border)] bg-[var(--tw-surface-panel)] px-2.5 text-sm text-[var(--tw-label-primary)] outline-none transition-colors placeholder:text-[var(--tw-label-tertiary)] focus:border-[#4176e6]`;function Dn({open:e,prompts:t,value:o,force:c=!1,onClose:l,onMount:u,onCreate:d,target:f=`项目`,createHint:p=`会按插件自带的模板生成(规划 / 探索 / 生成代码三段),之后可在「提示词管理」里改。`}){let[ee,te]=(0,yn.useState)(o),[m,h]=(0,yn.useState)(``),[g,_]=(0,yn.useState)(!1),[v,y]=(0,yn.useState)(``),[ne,b]=(0,yn.useState)(!1),[x,S]=(0,yn.useState)(``);(0,yn.useEffect)(()=>{e&&(te(o),_(!1),y(``),b(!1),S(``),h(``))},[e,o]);let re=m.trim()?t.filter(e=>e.toLowerCase().includes(m.trim().toLowerCase())):t,C=e=>{te(e),b(!1),S(``),y(``)},w=()=>{te(``),b(!0),S(`我的提示词.md`),y(``)},ie=()=>{b(!1),S(``),y(``),te(o)},ae=async()=>{if(!g&&ee){_(!0),y(``);try{await u(ee)}catch(e){y(e instanceof Error?e.message:String(e))}finally{_(!1)}}},T=async()=>{if(!d||g)return;let e=x.trim();if(!e)y(`先给新提示词起个文件名`);else{_(!0),y(``);try{await u(await d(e)),b(!1),S(``)}catch(e){y(e instanceof Error?e.message:String(e))}finally{_(!1)}}};return(0,Q.jsxs)(i,{open:e,onClose:g?()=>void 0:l,className:`relative z-110`,children:[(0,Q.jsx)(a,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":`true`}),(0,Q.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,Q.jsxs)(n,{transition:!0,className:`tw-dialog-panel-anim flex max-h-[min(80vh,620px)] w-full max-w-xl flex-col overflow-hidden rounded-xl border shadow-xl ${bn}`,children:[(0,Q.jsxs)(`div`,{className:`shrink-0 border-b border-[var(--tw-border)] px-5 py-4`,children:[(0,Q.jsx)(r,{className:`text-base font-semibold ${xn}`,children:c?`先挂载提示词`:`挂载提示词`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed ${Sn}`,children:c?`这个${f}还没有挂载提示词,选一份挂上才能开始生成;也可以先取消,稍后再挂。`:`一个${f}只挂一份提示词,换新的会立即取消上一份的引用`})]}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-5 py-4`,children:[t.length?(0,Q.jsx)(`input`,{className:`${En} shrink-0`,value:m,onChange:e=>h(e.target.value),placeholder:`搜索提示词文件名`,"aria-label":`搜索提示词`,disabled:g}):null,t.length?(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-1 overflow-y-auto overscroll-contain rounded-lg border border-[var(--tw-border)] p-1`,children:[re.map(e=>{let t=ee===e;return(0,Q.jsxs)(`button`,{type:`button`,disabled:g,onClick:()=>C(e),"aria-pressed":t,className:`flex w-full min-w-0 items-center gap-2 rounded-md px-2.5 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed ${t?`bg-(--tw-accent-soft) font-medium text-(--tw-accent)`:`text-[var(--tw-label-primary)] hover:bg-[var(--tw-session-hover-bg)]`}`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-3 shrink-0 rounded-full border ${t?`border-[#4176e6] bg-[#4176e6] shadow-[inset_0_0_0_2px_var(--tw-surface-panel)]`:`border-[var(--tw-border)]`}`}),(0,Q.jsx)(s,{text:e,className:`min-w-0 flex-1 truncate`})]},e)}),re.length?null:(0,Q.jsxs)(`p`,{className:`px-2.5 py-6 text-center text-xs ${Cn}`,children:[`没有匹配「`,m.trim(),`」的提示词`]})]}):(0,Q.jsx)(`p`,{className:`rounded-lg border border-dashed border-[var(--tw-border)] px-3 py-6 text-center text-xs ${Cn}`,children:`「提示词管理」里还没有可用的提示词,用下面的卡片新建一份再挂上。`}),d?ne?(0,Q.jsxs)(`div`,{className:`shrink-0 rounded-lg border border-[var(--tw-border)] p-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium ${xn}`,children:`新建提示词并挂载`}),(0,Q.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed ${Sn}`,children:p}),(0,Q.jsx)(`input`,{className:`${En} mt-2`,value:x,autoFocus:!0,placeholder:`文件名,例如 我的登录流程.md`,"aria-label":`新提示词文件名`,onChange:e=>S(e.target.value),onKeyDown:e=>{e.key===`Enter`&&T()}})]}):(0,Q.jsxs)(`button`,{type:`button`,disabled:g,onClick:w,className:`flex w-full shrink-0 items-center gap-3 rounded-lg border border-dashed border-[var(--tw-border)] px-3 py-3 text-left transition-colors hover:border-[#4176e6] hover:bg-[var(--tw-session-hover-bg)] disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-(--tw-accent-soft) text-(--tw-accent)`,children:(0,Q.jsx)(`svg`,{className:`h-4 w-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:(0,Q.jsx)(`path`,{d:`M12 5v14M5 12h14`})})}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium ${xn}`,children:`新建提示词并挂载`}),(0,Q.jsx)(`span`,{className:`mt-0.5 block text-[11px] ${Sn}`,children:`按插件模板生成一份新的,建完直接挂到当前项目`})]})]}):null,v?(0,Q.jsx)(`p`,{className:`mt-3 rounded-lg bg-red-50 px-3 py-2 text-[11px] leading-relaxed break-words text-red-600`,children:v}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-[var(--tw-border)] px-5 py-3`,children:[c&&!ne?(0,Q.jsx)(`span`,{className:`mr-auto text-[11px] ${Cn}`,children:`不挂载时生成会被拦下`}):null,ne?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`button`,{type:`button`,className:Tn,onClick:ie,disabled:g,children:`取消`}),(0,Q.jsx)(`button`,{type:`button`,className:wn,onClick:()=>void T(),disabled:g||!x.trim(),children:g?`创建中…`:`创建并挂载`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`button`,{type:`button`,className:Tn,onClick:l,disabled:g,children:`取消`}),(0,Q.jsx)(`button`,{type:`button`,className:wn,onClick:()=>void ae(),disabled:g||!ee||!t.length,children:g?`保存中…`:`挂载`})]})]})]})})]})}export{vn as n,Dn as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,p as r}from"./app-config.CF1xVPmo.js";import{a as i,i as a,n as o,o as ee,s as te}from"./plugins.CVM1IaoC.js";import{t as s}from"./jsx-runtime.DUg_B_vD.js";import{t as ne}from"./ConfirmDialog.CsMwWevK.js";import{showToast as c}from"./Toast.BO2NFckG.js";import{i as re}from"./case-types.DS1EQ5yP.js";import{a as ie,k as ae}from"./req-analysis.dhgy4p2f.js";import{c as l,d as u,h as oe,n as d,p as se,r as ce,u as le,v as ue}from"./project-docs.DAw9bzgk.js";import{n as de}from"./doc-roots.DAJP9Svr.js";import{a as f,c as p,d as fe,i as m,l as h,o as g,s as _,u as v}from"./prompts-meta.C_MeYq8G.js";import{i as pe,n as me,r as he,t as ge}from"./DocsFileBrowser.CTICuWFf.js";import{t as _e,u as ve}from"./open-docs-in-session.Cj0J2-XT.js";import{M as ye,i as be,j as xe,r as Se}from"./case-review.C1hQRbQ2.js";import{r as Ce}from"./report-prompt.CAfZ6RIo.js";import{g as we,s as Te}from"./ui-auto.BmC9JJ_X.js";import{d as Ee,o as De,t as Oe,v as ke}from"./story-review.E_go1fvj.js";import{t as y}from"./NamePromptDialog.CS1pTTVl.js";import{m as b}from"./PmShared.BrBicDMN.js";var x=e(t(),1),S=`tw.prompts.mounted.v1`;function Ae(){try{let e=sessionStorage.getItem(r(S));if(!e)return{};let t=JSON.parse(e);if(!t||typeof t!=`object`)return{};let n={};for(let[e,r]of Object.entries(t))typeof e==`string`&&typeof r==`string`&&(n[e]=r);return n}catch{return{}}}function je(e){try{sessionStorage.setItem(r(S),JSON.stringify(e))}catch{}}var C=s(),Me=10;async function w(e=`.`){let{entries:t}=await l(`prompts`,e),n=[];for(let e of t)e.type===`file`?n.push(e):n.push(...await w(e.path));return n}function Ne({path:e,enabled:t,mounted:n}){let r=v(e,n);if(!r)return(0,C.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:`未关联`});if(r===`system`)return(0,C.jsx)(`span`,{className:`text-[11px] text-stone-600`,children:`系统默认`});let i=o(r)?.name??r,a=t[r]===!0,ee=g(e,n);return(0,C.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,C.jsx)(`span`,{className:`truncate text-[11px] text-stone-600`,children:i}),ee&&a?(0,C.jsx)(`span`,{className:`shrink-0 rounded bg-(--tw-accent-soft) px-1 text-[10px] text-(--tw-accent)`,children:`引用中`}):null]})}function T(){let e=he(`prompts`),[t,r]=(0,x.useState)(!1),[s,l]=(0,x.useState)(!0),[g,S]=(0,x.useState)(e?!0:null),[T,Pe]=(0,x.useState)(()=>e??[]),[E,D]=(0,x.useState)(null),[O,k]=(0,x.useState)(!1),[A,j]=(0,x.useState)({}),[M,N]=(0,x.useState)(null),[P,F]=(0,x.useState)(()=>i()),[I,Fe]=(0,x.useState)(()=>Ae()),[L,R]=(0,x.useState)(null),[z,B]=(0,x.useState)(null),[V,H]=(0,x.useState)(``),U=me(T,Me,`prompts`),W=(0,x.useRef)(!1),G=(0,x.useRef)(!1),K=(0,x.useRef)(!1),q=(0,x.useRef)(!1),J=(0,x.useRef)(!1),Y=(0,x.useCallback)(async()=>{D(null);try{let e=await w(`.`);Pe(e),pe(`prompts`,e)}catch(e){D(e instanceof Error?e.message:String(e))}},[]);(0,x.useEffect)(()=>{g&&P.reqAnalysis===!0&&!W.current&&(T.some(e=>e.name===`需求分析提示词.md`)||(W.current=!0,ae(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.reqAnalysis,T,Y]),(0,x.useEffect)(()=>{g&&P.storyReview===!0&&!G.current&&(T.some(e=>e.name===`用户故事审查提示词.md`)||(G.current=!0,De(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.storyReview,T,Y]),(0,x.useEffect)(()=>{g&&P.testPoints===!0&&!K.current&&(T.some(e=>e.name===`测试点生成提示词.md`)||(K.current=!0,ke(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.testPoints,T,Y]),(0,x.useEffect)(()=>{g&&P.caseReview===!0&&!q.current&&(T.some(e=>e.name===`用例质量评审提示词.md`)||(q.current=!0,ye(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.caseReview,T,Y]),(0,x.useEffect)(()=>{g&&P.caseBlindspot===!0&&!J.current&&(T.some(e=>e.name===`场景遗漏补全提示词.md`)||(J.current=!0,xe(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.caseBlindspot,T,Y]),(0,x.useEffect)(()=>{let e=ee(e=>{l(!!e.prompts),F(e)});return n().then(()=>{l(a(`prompts`)),F(i()),r(!0)}),e},[]),(0,x.useEffect)(()=>{t&&s&&(async()=>{await ce(`prompts`)?(await ve().catch(()=>null),await Y(),S(!0)):S(!1)})()},[t,s,Y]);let X=(0,x.useCallback)(async()=>{let e=await Te(),t=a(`reports`),n=t?await Ce().catch(()=>null):null;Fe(r=>{let i={};if(e)for(let t of e)i[p(t)]=`uiAuto`;else for(let[e,t]of Object.entries(r))t===`uiAuto`&&(i[e]=t);if(t){if(n?.promptFile)i[p(n.promptFile)]=`reports`;else for(let[e,t]of Object.entries(r))t===`reports`&&(i[e]=t)}if(P.reqAnalysis&&(i[p(ie)]=`reqAnalysis`),P.storyReview&&(i[p(Oe)]=`storyReview`),P.testPoints&&(i[p(Ee)]=`testPoints`),P.caseReview&&(i[p(be)]=`caseReview`),P.caseBlindspot&&(i[p(Se)]=`caseBlindspot`),P.caseGen)for(let e of re()){let t=(e.promptPath??``).trim();t&&(i[p(t)]=`caseGen`)}return je(i),i})},[P.reqAnalysis,P.storyReview,P.testPoints,P.caseReview,P.caseBlindspot,P.caseGen]);(0,x.useEffect)(()=>{if(!t||!s)return;X();let e=()=>{document.visibilityState===`visible`&&X()};document.addEventListener(`visibilitychange`,e);let n=we(()=>void X());return()=>{document.removeEventListener(`visibilitychange`,e),n()}},[t,s,P.uiAuto,P.reports,P.reqAnalysis,P.storyReview,P.testPoints,P.caseReview,P.caseBlindspot,P.caseGen,X]);let Z=(0,x.useMemo)(()=>Object.keys(A).filter(e=>A[e]),[A]),Q=(0,x.useCallback)(e=>{let t=v(e,I);return!t||t===`system`||fe(e)?``:P[t]===!0?t:``},[I,P]);async function Ie(e){k(!0),D(null);try{await le(`prompts`,e.path)}catch(e){D(e instanceof Error?e.message:String(e))}finally{k(!1)}}async function Le(e){k(!0),D(null);try{await _e(`prompts`,e)}catch(e){D(e instanceof Error?e.message:String(e)),k(!1)}}function Re(e){if(_(e.path)){D(`默认提示词不可删除`);return}if(m(e.path,P)){D(h(e.path,P));return}let t=Q(e.path);if(t){let e=o(t)?.name??t;D(`这份提示词正被「${e}」的项目挂载,先在那里换一份再删除`)}else N({kind:`one`,entry:e})}function ze(e){if(_(e.path)){D(`默认提示词不可改名`);return}if(m(e.path,P)){D(h(e.path,P));return}let t=Q(e.path);if(t){let e=o(t)?.name??t;D(`这份提示词正被「${e}」的项目挂载,先在那里换一份再改名`)}else R(e),H(``)}function Be(e){B(e),H(``)}async function Ve(){let e=M;if(e){N(null),k(!0),D(null);try{if(e.kind===`one`)await d(`prompts`,e.entry.path);else{let t=0;for(let n of e.paths)_(n)||m(n,P)||Q(n)?t+=1:await d(`prompts`,n);t&&D(`有 ${t} 个提示词仍被插件或项目引用,已跳过;先解除引用再删。`),j({})}await Y(),c(e.kind===`one`?`已删除「${e.entry.name}」`:`已删除 ${e.paths.length} 个提示词`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);D(t),c(`删除失败:${t}`,`error`)}finally{k(!1)}}}function He(){a(`promptGen`)?window.location.href=`/workbench/?plugin=promptGen`:D(te(`promptGen`))}let $=(0,x.useCallback)((e,t,n=``)=>{let r=(e===`.`?t:`${e}/${t}`).toLowerCase(),i=T.find(e=>e.path.toLowerCase()===r&&e.path.toLowerCase()!==n.toLowerCase());return i?i.name:``},[T]);async function Ue(e){let t=L;if(!t)return;let n=e.trim();if(!n||n===t.name){R(null),H(``);return}let r=$(u(t.path),n,t.path);if(r)H(`已存在同名文件「${r}」,换个名字再试`);else{k(!0),H(``);try{await oe(`prompts`,t.path,n),R(null),await Y(),c(`已重命名为「${n}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);H(t),c(`重命名失败:${t}`,`error`)}finally{k(!1)}}}async function We(e){let t=z;if(!t)return;let n=e.trim();if(!n)return;let r=$(u(t.path),n);if(r)H(`已存在同名文件「${r}」,换个名字再试`);else{k(!0),H(``);try{let{content:e}=await se(`prompts`,t.path);await ue(`prompts`,u(t.path)===`.`?n:`${u(t.path)}/${n}`,e),B(null),await Y(),c(`已复制为「${n}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);H(t),c(`复制失败:${t}`,`error`)}finally{k(!1)}}}let Ge=M?.kind===`one`?`删除「${M.entry.name}」?将从 ${de(`prompts`)} 中移除。`:M?.kind===`batch`?`确认删除已选中的 ${M.paths.length} 个提示词?此操作不可恢复。`:``;return t?s?g===null?(0,C.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在连接本地文档服务`,children:(0,C.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,C.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):g?(0,C.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,children:[(0,C.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,C.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0`,children:[U.query.trim()?(0,C.jsxs)(C.Fragment,{children:[`匹配 `,(0,C.jsx)(`span`,{className:`font-medium text-stone-800`,children:U.filtered.length}),` 个`,(0,C.jsxs)(`span`,{className:`text-stone-400`,children:[` · 共 `,T.length]})]}):(0,C.jsxs)(C.Fragment,{children:[`共 `,(0,C.jsx)(`span`,{className:`font-medium text-stone-800`,children:T.length}),` 个提示词`]}),Z.length>0?(0,C.jsxs)(`span`,{className:`text-stone-400`,children:[` · 已选 `,Z.length]}):null]}),(0,C.jsx)(`button`,{type:`button`,disabled:O||Z.length===0,onClick:()=>N({kind:`batch`,paths:Z}),className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-red-600 border border-red-200 rounded-lg hover:bg-red-50 disabled:opacity-40`,children:`批量删除`}),(0,C.jsx)(`button`,{type:`button`,disabled:O,onClick:He,className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40`,children:`生成提示词`})]}),E?(0,C.jsx)(`div`,{className:`shrink-0 mx-4 mt-3 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:E}):null,(0,C.jsx)(ge,{resizeKey:`docs:prompts:cols:v1`,files:T,filtered:U.filtered,pageFiles:U.pageFiles,query:U.query,onQuery:U.setQuery,sortBy:U.sortBy,onSortBy:U.setSortBy,page:U.page,totalPages:U.totalPages,pageSize:U.pageSize,onPage:U.setPage,onPageSize:U.setPageSize,busy:O,emptyText:`暂无提示词,点击「生成提示词」前往我的工作台。`,searchPlaceholder:`搜索文件名或路径…`,selectable:e=>!f(e.path,P)&&!Q(e.path),selected:A,onToggleRow:e=>j(t=>({...t,[e]:!t[e]})),onSelectPage:(e,t)=>j(n=>{let r={...n};for(let n of e)t?r[n]=!0:delete r[n];return r}),onRowDoubleClick:e=>void Ie(e),extraColumn:{header:`关联插件`,render:e=>(0,C.jsx)(Ne,{path:e.path,enabled:P,mounted:I})},renderNameAction:e=>(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`button`,{type:`button`,disabled:O,"aria-label":`重命名 ${e.name}`,onClick:()=>ze(e),className:`inline-flex h-6 w-6 items-center justify-center rounded text-stone-400 transition-colors hover:bg-[#e8f0fe] hover:text-[#4176e6] disabled:opacity-40`,children:(0,C.jsx)(b,{name:`pencil`,size:12})}),(0,C.jsx)(`button`,{type:`button`,disabled:O,"aria-label":`复制 ${e.name}`,onClick:()=>Be(e),className:`inline-flex h-6 w-6 items-center justify-center rounded text-stone-400 transition-colors hover:bg-[#e8f0fe] hover:text-[#4176e6] disabled:opacity-40`,children:(0,C.jsx)(b,{name:`copy`,size:12})})]}),renderActions:e=>{let t=f(e.path,P)||!!Q(e.path);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`button`,{type:`button`,disabled:O,onClick:()=>void Le(e),className:`inline-flex h-6 items-center whitespace-nowrap rounded bg-[#4176e6] px-2 text-xs text-white hover:bg-[#3565c7] cursor-pointer disabled:opacity-40`,children:`在会话中打开`}),(0,C.jsx)(`button`,{type:`button`,disabled:O||t,"aria-label":`删除 ${e.name}`,onClick:()=>Re(e),className:`tw-icon-danger inline-flex h-6 w-6 items-center justify-center rounded`,children:(0,C.jsx)(b,{name:`trash`,size:12})})]})}}),(0,C.jsx)(y,{open:L!=null,title:`重命名提示词`,label:`文件名称`,initialValue:L?.name??``,lockExtension:!0,confirmLabel:`保存`,error:V,onClose:()=>{R(null),H(``)},onConfirm:e=>void Ue(e)}),(0,C.jsx)(y,{open:z!=null,title:`复制提示词`,label:`新文件名称`,initialValue:z?z.name.replace(/(\.[^.]+)?$/,e=>`(副本)${e}`):``,lockExtension:!0,confirmLabel:`复制`,error:V,onClose:()=>{B(null),H(``)},onConfirm:e=>void We(e)}),(0,C.jsx)(ne,{open:M!=null,title:M?.kind===`batch`?`批量删除`:`删除提示词`,message:Ge,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>N(null),onConfirm:()=>void Ve()})]}):(0,C.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:`提示词管理需要本地文档服务,当前未就绪。`}):(0,C.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:te(`prompts`)}):(0,C.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,C.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,C.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}export{T as default};
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,p as r}from"./app-config.CF1xVPmo.js";import{a as i,i as a,n as o,o as ee,s as te}from"./plugins.CVM1IaoC.js";import{t as s}from"./jsx-runtime.DUg_B_vD.js";import{t as ne}from"./ConfirmDialog.CsMwWevK.js";import{showToast as c}from"./Toast.BO2NFckG.js";import{i as re}from"./case-types.DS1EQ5yP.js";import{a as ie,k as ae}from"./req-analysis.dhgy4p2f.js";import{c as l,d as u,h as oe,n as d,p as se,r as ce,u as le,v as ue}from"./project-docs.DAw9bzgk.js";import{n as de}from"./doc-roots.DAJP9Svr.js";import{a as f,c as p,d as fe,i as m,l as h,o as g,s as _,u as v}from"./prompts-meta.C_MeYq8G.js";import{i as pe,n as me,r as he,t as ge}from"./DocsFileBrowser.BM3nH4VD.js";import{t as _e,u as ve}from"./open-docs-in-session.Cj0J2-XT.js";import{M as ye,i as be,j as xe,r as Se}from"./case-review.C1hQRbQ2.js";import{r as Ce}from"./report-prompt.CAfZ6RIo.js";import{g as we,s as Te}from"./ui-auto.BmC9JJ_X.js";import{d as Ee,o as De,t as Oe,v as ke}from"./story-review.BbdIf5zg.js";import{t as y}from"./NamePromptDialog.CS1pTTVl.js";import{m as b}from"./PmShared.BrBicDMN.js";var x=e(t(),1),S=`tw.prompts.mounted.v1`;function Ae(){try{let e=sessionStorage.getItem(r(S));if(!e)return{};let t=JSON.parse(e);if(!t||typeof t!=`object`)return{};let n={};for(let[e,r]of Object.entries(t))typeof e==`string`&&typeof r==`string`&&(n[e]=r);return n}catch{return{}}}function je(e){try{sessionStorage.setItem(r(S),JSON.stringify(e))}catch{}}var C=s(),Me=10;async function w(e=`.`){let{entries:t}=await l(`prompts`,e),n=[];for(let e of t)e.type===`file`?n.push(e):n.push(...await w(e.path));return n}function Ne({path:e,enabled:t,mounted:n}){let r=v(e,n);if(!r)return(0,C.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:`未关联`});if(r===`system`)return(0,C.jsx)(`span`,{className:`text-[11px] text-stone-600`,children:`系统默认`});let i=o(r)?.name??r,a=t[r]===!0,ee=g(e,n);return(0,C.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,C.jsx)(`span`,{className:`truncate text-[11px] text-stone-600`,children:i}),ee&&a?(0,C.jsx)(`span`,{className:`shrink-0 rounded bg-(--tw-accent-soft) px-1 text-[10px] text-(--tw-accent)`,children:`引用中`}):null]})}function T(){let e=he(`prompts`),[t,r]=(0,x.useState)(!1),[s,l]=(0,x.useState)(!0),[g,S]=(0,x.useState)(e?!0:null),[T,Pe]=(0,x.useState)(()=>e??[]),[E,D]=(0,x.useState)(null),[O,k]=(0,x.useState)(!1),[A,j]=(0,x.useState)({}),[M,N]=(0,x.useState)(null),[P,F]=(0,x.useState)(()=>i()),[I,Fe]=(0,x.useState)(()=>Ae()),[L,R]=(0,x.useState)(null),[z,B]=(0,x.useState)(null),[V,H]=(0,x.useState)(``),U=me(T,Me,`prompts`),W=(0,x.useRef)(!1),G=(0,x.useRef)(!1),K=(0,x.useRef)(!1),q=(0,x.useRef)(!1),J=(0,x.useRef)(!1),Y=(0,x.useCallback)(async()=>{D(null);try{let e=await w(`.`);Pe(e),pe(`prompts`,e)}catch(e){D(e instanceof Error?e.message:String(e))}},[]);(0,x.useEffect)(()=>{g&&P.reqAnalysis===!0&&!W.current&&(T.some(e=>e.name===`需求分析提示词.md`)||(W.current=!0,ae(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.reqAnalysis,T,Y]),(0,x.useEffect)(()=>{g&&P.storyReview===!0&&!G.current&&(T.some(e=>e.name===`用户故事审查提示词.md`)||(G.current=!0,De(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.storyReview,T,Y]),(0,x.useEffect)(()=>{g&&P.testPoints===!0&&!K.current&&(T.some(e=>e.name===`测试点生成提示词.md`)||(K.current=!0,ke(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.testPoints,T,Y]),(0,x.useEffect)(()=>{g&&P.caseReview===!0&&!q.current&&(T.some(e=>e.name===`用例质量评审提示词.md`)||(q.current=!0,ye(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.caseReview,T,Y]),(0,x.useEffect)(()=>{g&&P.caseBlindspot===!0&&!J.current&&(T.some(e=>e.name===`场景遗漏补全提示词.md`)||(J.current=!0,xe(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.caseBlindspot,T,Y]),(0,x.useEffect)(()=>{let e=ee(e=>{l(!!e.prompts),F(e)});return n().then(()=>{l(a(`prompts`)),F(i()),r(!0)}),e},[]),(0,x.useEffect)(()=>{t&&s&&(async()=>{await ce(`prompts`)?(await ve().catch(()=>null),await Y(),S(!0)):S(!1)})()},[t,s,Y]);let X=(0,x.useCallback)(async()=>{let e=await Te(),t=a(`reports`),n=t?await Ce().catch(()=>null):null;Fe(r=>{let i={};if(e)for(let t of e)i[p(t)]=`uiAuto`;else for(let[e,t]of Object.entries(r))t===`uiAuto`&&(i[e]=t);if(t){if(n?.promptFile)i[p(n.promptFile)]=`reports`;else for(let[e,t]of Object.entries(r))t===`reports`&&(i[e]=t)}if(P.reqAnalysis&&(i[p(ie)]=`reqAnalysis`),P.storyReview&&(i[p(Oe)]=`storyReview`),P.testPoints&&(i[p(Ee)]=`testPoints`),P.caseReview&&(i[p(be)]=`caseReview`),P.caseBlindspot&&(i[p(Se)]=`caseBlindspot`),P.caseGen)for(let e of re()){let t=(e.promptPath??``).trim();t&&(i[p(t)]=`caseGen`)}return je(i),i})},[P.reqAnalysis,P.storyReview,P.testPoints,P.caseReview,P.caseBlindspot,P.caseGen]);(0,x.useEffect)(()=>{if(!t||!s)return;X();let e=()=>{document.visibilityState===`visible`&&X()};document.addEventListener(`visibilitychange`,e);let n=we(()=>void X());return()=>{document.removeEventListener(`visibilitychange`,e),n()}},[t,s,P.uiAuto,P.reports,P.reqAnalysis,P.storyReview,P.testPoints,P.caseReview,P.caseBlindspot,P.caseGen,X]);let Z=(0,x.useMemo)(()=>Object.keys(A).filter(e=>A[e]),[A]),Q=(0,x.useCallback)(e=>{let t=v(e,I);return!t||t===`system`||fe(e)?``:P[t]===!0?t:``},[I,P]);async function Ie(e){k(!0),D(null);try{await le(`prompts`,e.path)}catch(e){D(e instanceof Error?e.message:String(e))}finally{k(!1)}}async function Le(e){k(!0),D(null);try{await _e(`prompts`,e)}catch(e){D(e instanceof Error?e.message:String(e)),k(!1)}}function Re(e){if(_(e.path)){D(`默认提示词不可删除`);return}if(m(e.path,P)){D(h(e.path,P));return}let t=Q(e.path);if(t){let e=o(t)?.name??t;D(`这份提示词正被「${e}」的项目挂载,先在那里换一份再删除`)}else N({kind:`one`,entry:e})}function ze(e){if(_(e.path)){D(`默认提示词不可改名`);return}if(m(e.path,P)){D(h(e.path,P));return}let t=Q(e.path);if(t){let e=o(t)?.name??t;D(`这份提示词正被「${e}」的项目挂载,先在那里换一份再改名`)}else R(e),H(``)}function Be(e){B(e),H(``)}async function Ve(){let e=M;if(e){N(null),k(!0),D(null);try{if(e.kind===`one`)await d(`prompts`,e.entry.path);else{let t=0;for(let n of e.paths)_(n)||m(n,P)||Q(n)?t+=1:await d(`prompts`,n);t&&D(`有 ${t} 个提示词仍被插件或项目引用,已跳过;先解除引用再删。`),j({})}await Y(),c(e.kind===`one`?`已删除「${e.entry.name}」`:`已删除 ${e.paths.length} 个提示词`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);D(t),c(`删除失败:${t}`,`error`)}finally{k(!1)}}}function He(){a(`promptGen`)?window.location.href=`/workbench/?plugin=promptGen`:D(te(`promptGen`))}let $=(0,x.useCallback)((e,t,n=``)=>{let r=(e===`.`?t:`${e}/${t}`).toLowerCase(),i=T.find(e=>e.path.toLowerCase()===r&&e.path.toLowerCase()!==n.toLowerCase());return i?i.name:``},[T]);async function Ue(e){let t=L;if(!t)return;let n=e.trim();if(!n||n===t.name){R(null),H(``);return}let r=$(u(t.path),n,t.path);if(r)H(`已存在同名文件「${r}」,换个名字再试`);else{k(!0),H(``);try{await oe(`prompts`,t.path,n),R(null),await Y(),c(`已重命名为「${n}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);H(t),c(`重命名失败:${t}`,`error`)}finally{k(!1)}}}async function We(e){let t=z;if(!t)return;let n=e.trim();if(!n)return;let r=$(u(t.path),n);if(r)H(`已存在同名文件「${r}」,换个名字再试`);else{k(!0),H(``);try{let{content:e}=await se(`prompts`,t.path);await ue(`prompts`,u(t.path)===`.`?n:`${u(t.path)}/${n}`,e),B(null),await Y(),c(`已复制为「${n}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);H(t),c(`复制失败:${t}`,`error`)}finally{k(!1)}}}let Ge=M?.kind===`one`?`删除「${M.entry.name}」?将从 ${de(`prompts`)} 中移除。`:M?.kind===`batch`?`确认删除已选中的 ${M.paths.length} 个提示词?此操作不可恢复。`:``;return t?s?g===null?(0,C.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在连接本地文档服务`,children:(0,C.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,C.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):g?(0,C.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,children:[(0,C.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,C.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0`,children:[U.query.trim()?(0,C.jsxs)(C.Fragment,{children:[`匹配 `,(0,C.jsx)(`span`,{className:`font-medium text-stone-800`,children:U.filtered.length}),` 个`,(0,C.jsxs)(`span`,{className:`text-stone-400`,children:[` · 共 `,T.length]})]}):(0,C.jsxs)(C.Fragment,{children:[`共 `,(0,C.jsx)(`span`,{className:`font-medium text-stone-800`,children:T.length}),` 个提示词`]}),Z.length>0?(0,C.jsxs)(`span`,{className:`text-stone-400`,children:[` · 已选 `,Z.length]}):null]}),(0,C.jsx)(`button`,{type:`button`,disabled:O||Z.length===0,onClick:()=>N({kind:`batch`,paths:Z}),className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-red-600 border border-red-200 rounded-lg hover:bg-red-50 disabled:opacity-40`,children:`批量删除`}),(0,C.jsx)(`button`,{type:`button`,disabled:O,onClick:He,className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40`,children:`生成提示词`})]}),E?(0,C.jsx)(`div`,{className:`shrink-0 mx-4 mt-3 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:E}):null,(0,C.jsx)(ge,{resizeKey:`docs:prompts:cols:v1`,files:T,filtered:U.filtered,pageFiles:U.pageFiles,query:U.query,onQuery:U.setQuery,sortBy:U.sortBy,onSortBy:U.setSortBy,page:U.page,totalPages:U.totalPages,pageSize:U.pageSize,onPage:U.setPage,onPageSize:U.setPageSize,busy:O,emptyText:`暂无提示词,点击「生成提示词」前往我的工作台。`,searchPlaceholder:`搜索文件名或路径…`,selectable:e=>!f(e.path,P)&&!Q(e.path),selected:A,onToggleRow:e=>j(t=>({...t,[e]:!t[e]})),onSelectPage:(e,t)=>j(n=>{let r={...n};for(let n of e)t?r[n]=!0:delete r[n];return r}),onRowDoubleClick:e=>void Ie(e),extraColumn:{header:`关联插件`,render:e=>(0,C.jsx)(Ne,{path:e.path,enabled:P,mounted:I})},renderNameAction:e=>(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`button`,{type:`button`,disabled:O,"aria-label":`重命名 ${e.name}`,onClick:()=>ze(e),className:`inline-flex h-6 w-6 items-center justify-center rounded text-stone-400 transition-colors hover:bg-[#e8f0fe] hover:text-[#4176e6] disabled:opacity-40`,children:(0,C.jsx)(b,{name:`pencil`,size:12})}),(0,C.jsx)(`button`,{type:`button`,disabled:O,"aria-label":`复制 ${e.name}`,onClick:()=>Be(e),className:`inline-flex h-6 w-6 items-center justify-center rounded text-stone-400 transition-colors hover:bg-[#e8f0fe] hover:text-[#4176e6] disabled:opacity-40`,children:(0,C.jsx)(b,{name:`copy`,size:12})})]}),renderActions:e=>{let t=f(e.path,P)||!!Q(e.path);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`button`,{type:`button`,disabled:O,onClick:()=>void Le(e),className:`inline-flex h-6 items-center whitespace-nowrap rounded bg-[#4176e6] px-2 text-xs text-white hover:bg-[#3565c7] cursor-pointer disabled:opacity-40`,children:`在会话中打开`}),(0,C.jsx)(`button`,{type:`button`,disabled:O||t,"aria-label":`删除 ${e.name}`,onClick:()=>Re(e),className:`tw-icon-danger inline-flex h-6 w-6 items-center justify-center rounded`,children:(0,C.jsx)(b,{name:`trash`,size:12})})]})}}),(0,C.jsx)(y,{open:L!=null,title:`重命名提示词`,label:`文件名称`,initialValue:L?.name??``,lockExtension:!0,confirmLabel:`保存`,error:V,onClose:()=>{R(null),H(``)},onConfirm:e=>void Ue(e)}),(0,C.jsx)(y,{open:z!=null,title:`复制提示词`,label:`新文件名称`,initialValue:z?z.name.replace(/(\.[^.]+)?$/,e=>`(副本)${e}`):``,lockExtension:!0,confirmLabel:`复制`,error:V,onClose:()=>{B(null),H(``)},onConfirm:e=>void We(e)}),(0,C.jsx)(ne,{open:M!=null,title:M?.kind===`batch`?`批量删除`:`删除提示词`,message:Ge,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>N(null),onConfirm:()=>void Ve()})]}):(0,C.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:`提示词管理需要本地文档服务,当前未就绪。`}):(0,C.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:te(`prompts`)}):(0,C.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,C.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,C.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}export{T as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.CF1xVPmo.js";import{s as r}from"./plugins.CVM1IaoC.js";import{a as i,i as a,n as o,o as s,r as c,t as l}from"./view-prefs.D1snIG5o.js";import{t as u}from"./jsx-runtime.DUg_B_vD.js";import{t as d}from"./ConfirmDialog.CsMwWevK.js";import{t as f}from"./OverflowHint.pvo2Xc8R.js";import{t as p}from"./SelectDropdown.apWlFGbA.js";import{showToast as m}from"./Toast.BO2NFckG.js";import{A as h,C as g,D as ee,E as te,S as _,T as v,_ as y,a as ne,b as re,c as ie,d as ae,f as oe,h as se,i as ce,j as b,k as le,l as ue,m as de,n as x,o as fe,r as S,s as pe,t as me,u as he,v as ge,w as _e,x as ve,y as ye}from"./req-analysis.dhgy4p2f.js";import{o as be}from"./project-docs.DAw9bzgk.js";import{s as xe}from"./llm.BuR7z55C.js";import{f as Se,l as Ce,p as we}from"./settings.B1yetppp.js";import{a as C,c as Te,d as Ee,f as De,g as Oe,h as ke,i as Ae,l as je,m as Me,n as Ne,o as Pe,p as Fe,r as Ie,s as Le,u as Re,v as ze}from"./story-review.
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.CF1xVPmo.js";import{s as r}from"./plugins.CVM1IaoC.js";import{a as i,i as a,n as o,o as s,r as c,t as l}from"./view-prefs.D1snIG5o.js";import{t as u}from"./jsx-runtime.DUg_B_vD.js";import{t as d}from"./ConfirmDialog.CsMwWevK.js";import{t as f}from"./OverflowHint.pvo2Xc8R.js";import{t as p}from"./SelectDropdown.apWlFGbA.js";import{showToast as m}from"./Toast.BO2NFckG.js";import{A as h,C as g,D as ee,E as te,S as _,T as v,_ as y,a as ne,b as re,c as ie,d as ae,f as oe,h as se,i as ce,j as b,k as le,l as ue,m as de,n as x,o as fe,r as S,s as pe,t as me,u as he,v as ge,w as _e,x as ve,y as ye}from"./req-analysis.dhgy4p2f.js";import{o as be}from"./project-docs.DAw9bzgk.js";import{s as xe}from"./llm.BuR7z55C.js";import{f as Se,l as Ce,p as we}from"./settings.B1yetppp.js";import{a as C,c as Te,d as Ee,f as De,g as Oe,h as ke,i as Ae,l as je,m as Me,n as Ne,o as Pe,p as Fe,r as Ie,s as Le,u as Re,v as ze}from"./story-review.BbdIf5zg.js";import{t as Be}from"./hydrate-cache.CmC22o_H.js";import{S as w,_ as Ve,g as He,k as Ue,m as T,u as We}from"./PmShared.BrBicDMN.js";var E=e(t(),1),Ge=`可用工具(只调用这些,不要自己编工具名):
|
|
2
2
|
- req_set_outline:提交本批「需求条目」,返回每个条目的 id。
|
|
3
3
|
- req_set_stories:提交「用户故事」;补写时提交合并后的完整故事集(带原 id 原地更新)。
|
|
4
4
|
- req_save_check:提交体检结果(缺口清单 + 结论)。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.CF1xVPmo.js";import{i as r,o as i,s as a}from"./plugins.CVM1IaoC.js";import{t as o}from"./jsx-runtime.DUg_B_vD.js";import{t as s}from"./ConfirmDialog.CsMwWevK.js";import{n as c,t as ee}from"./DocsPager.B9VhI6E3.js";import{showToast as l}from"./Toast.BO2NFckG.js";import{a as te,c as u,d as ne,g as re,h as ie,i as ae,l as oe,m as se,n as ce,p as le,r as ue,s as d,t as de,u as fe}from"./project-docs.DAw9bzgk.js";import{n as pe}from"./doc-roots.DAJP9Svr.js";import{n as me,t as he}from"./docs-format.BlGh-XA_.js";import{t as ge}from"./useListAnim.BoerpmsB.js";import{t as f}from"./NamePromptDialog.CS1pTTVl.js";var p=e(t(),1),m=o(),_e=5;function h({className:e=`w-4 h-4`,open:t=!1}){return(0,m.jsx)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:t?(0,m.jsx)(`path`,{d:`M6 14l1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`}):(0,m.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z`})})}function g({className:e=`w-3 h-3`}){return(0,m.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,m.jsx)(`path`,{d:`M21.17 6.81a1 1 0 0 0-3.99-3.99L3.84 16.17a2 2 0 0 0-.5.83l-1.32 4.35a.5.5 0 0 0 .62.62l4.35-1.32a2 2 0 0 0 .83-.5z`}),(0,m.jsx)(`path`,{d:`m15 5 4 4`})]})}function _({className:e=`w-3 h-3`}){return(0,m.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,m.jsx)(`path`,{d:`M3 6h18`}),(0,m.jsx)(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),(0,m.jsx)(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}),(0,m.jsx)(`path`,{d:`M10 11v6`}),(0,m.jsx)(`path`,{d:`M14 11v6`})]})}function v({node:e,depth:t,activePath:n,expanded:r,globalOpen:i,onToggle:a,onSelect:o}){let s=r[e.path]??i,c=n===e.path;return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`group flex items-center rounded-md ${c?`bg-[#e8f0fe]`:`hover:bg-stone-100`}`,style:{paddingLeft:8+t*12},children:(0,m.jsxs)(`button`,{type:`button`,onClick:()=>{o(e.path),e.children.length&&a(e.path)},"aria-expanded":e.children.length?s:void 0,className:`flex-1 min-w-0 flex items-center gap-1.5 py-1.5 pr-1 text-sm text-left ${c?`text-[#4176e6]`:`text-stone-600`}`,children:[(0,m.jsx)(`span`,{className:`w-3.5 shrink-0`,"aria-hidden":`true`}),(0,m.jsx)(h,{open:!!(e.children.length&&s),className:`w-3.5 h-3.5 shrink-0 text-[#4176e6]`}),(0,m.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,"data-hint":e.name,children:e.name}),(0,m.jsxs)(`span`,{className:`shrink-0 tabular-nums text-[11px] text-stone-400`,children:[`(`,e.fileCount??0,`)`]})]})}),(0,m.jsx)(`div`,{className:`tw-collapse ${s?`is-open`:``}`,children:(0,m.jsx)(`div`,{className:`tw-collapse-inner space-y-1`,children:e.children.map(e=>(0,m.jsx)(v,{node:e,depth:t+1,activePath:n,expanded:r,globalOpen:i,onToggle:a,onSelect:o},e.path))})})]})}function y(){let[e,t]=(0,p.useState)(()=>r(`requirements`)),[o,y]=(0,p.useState)(!1),[b,x]=(0,p.useState)(null),[S,ve]=(0,p.useState)([]),[ye,be]=(0,p.useState)(0),[C,w]=(0,p.useState)(`.`),[T,E]=(0,p.useState)([]),[xe,D]=(0,p.useState)({}),[O,Se]=(0,p.useState)(!0),[k,A]=(0,p.useState)(null),[j,M]=(0,p.useState)(!1),[N,P]=(0,p.useState)(null),[Ce,F]=(0,p.useState)(!1),[I,L]=(0,p.useState)(null),[R,z]=(0,p.useState)(null),[we,B]=(0,p.useState)(1),[V,Te]=c(_e),[Ee,H]=(0,p.useState)(null),U=(0,p.useRef)(null),{cls:De,play:W}=ge(),G=(0,p.useCallback)(async()=>{let e=await ae(`requirements`);ve(e.tree),be(e.totalFiles)},[]),K=(0,p.useCallback)(async(e=C)=>{A(null);try{let[t]=await Promise.all([u(`requirements`,e),G()]);E(t.entries),w(t.path)}catch(e){A(e instanceof Error?e.message:String(e))}},[C,G]);(0,p.useEffect)(()=>{let e=i(e=>t(!!e.requirements));return n().then(()=>{t(r(`requirements`)),y(!0)}),e},[]),(0,p.useEffect)(()=>{o&&e&&(async()=>{if(!await ue(`requirements`))x(!1);else try{let[e]=await Promise.all([u(`requirements`,`.`),G()]);E(e.entries),w(e.path),x(!0)}catch(e){A(e instanceof Error?e.message:String(e)),x(!0)}})()},[o,e,G]);function Oe(){Se(e=>!e),D({})}async function q(e){W(),w(e),B(1),P(null),H(null),A(null);try{let t=await u(`requirements`,e);E(t.entries)}catch(e){A(e instanceof Error?e.message:String(e))}}async function ke(e){F(!1),M(!0),A(null);try{await oe(`requirements`,C,e),await K(C),l(`已新建文件夹「${e}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),l(`新建文件夹失败:${t}`,`error`)}finally{M(!1)}}async function Ae(e){if(e.type===`file`){M(!0),A(null);try{await fe(`requirements`,e.path)}catch(e){A(e instanceof Error?e.message:String(e))}finally{M(!1)}}}async function je(e){if(e?.length){M(!0),A(null);try{for(let t of Array.from(e))await re(`requirements`,C,t);await K(C),l(`已上传 ${e.length} 个文件`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),l(`上传失败:${t}`,`error`)}finally{M(!1),U.current&&(U.current.value=``)}}}function Me(e){let t=te(S,e.path),n=t?.fileCount??0,r=t?de(t):0;L({...e,isDir:!0,blocked:n>0||r>0,files:n,dirs:r})}function J(e){L({name:e.name,path:e.path,isDir:!1})}function Y(e,t){z({...e,isDir:t})}async function Ne(){let e=I;if(e&&(L(null),!e.blocked)){M(!0),A(null);try{await ce(`requirements`,e.path),N&&d(N.path,e.path)&&P(null);let t=d(C,e.path)?ne(e.path):C;await K(t),l(`已删除「${e.name}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),l(`删除失败:${t}`,`error`)}finally{M(!1)}}}async function Pe(e){let t=R;if(t&&(z(null),e!==t.name)){M(!0),A(null);try{let n=await ie(`requirements`,t.path,e);await K(se(C,t.path,n)),l(`已重命名为「${e}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),l(`重命名失败:${t}`,`error`)}finally{M(!1)}}}let Fe=(()=>{if(!I)return``;if(!I.isDir)return`删除文件「${I.name}」?将移入系统废纸篓,可随时找回。`;if(I.blocked){let e=[];return I.files&&e.push(`${I.files} 个文件`),I.dirs&&e.push(`${I.dirs} 个子文件夹`),`文件夹「${I.name}」中还有 ${e.join(`、`)},请先清空内部内容后再删除。`}return`删除文件夹「${I.name}」?将移入系统废纸篓。`})();async function Ie(e){if(e.type!==`file`)return;let t=e.name.toLowerCase();if(t.endsWith(`.md`)||t.endsWith(`.txt`)){M(!0),A(null);try{let t=await le(`requirements`,e.path);P({path:t.path,content:t.content})}catch(e){A(e instanceof Error?e.message:String(e))}finally{M(!1)}}}if(!o)return(0,m.jsx)(`div`,{className:`tw-lib-probing`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,m.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})});if(!e)return(0,m.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:a(`requirements`)});if(b===null)return(0,m.jsx)(`div`,{className:`tw-lib-probing`,"aria-busy":`true`,"aria-label":`正在连接本地文档服务`,children:(0,m.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})});if(!b)return(0,m.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:`需求文档库需要本地文档服务,当前未就绪。`});let X=T.filter(e=>e.type===`file`).slice().sort((e,t)=>(t.ctime??t.mtime??0)-(e.ctime??e.mtime??0)),Z=T.filter(e=>e.type===`dir`),Q=Math.max(1,Math.ceil(X.length/V)),$=Math.min(we,Q),Le=X.slice(($-1)*V,$*V);function Re(e){W(),Te(e),B(1)}return(0,m.jsxs)(`div`,{className:`flex gap-4 min-h-0`,children:[(0,m.jsxs)(`aside`,{className:`w-56 shrink-0 rounded-xl border border-stone-200 bg-white flex flex-col overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`px-3 py-2.5 border-b border-stone-100 flex items-center justify-between`,children:[(0,m.jsx)(`span`,{className:`text-xs font-semibold text-stone-500`,children:`文件夹`}),(0,m.jsx)(`button`,{type:`button`,disabled:j,onClick:()=>F(!0),className:`tw-mkdir-btn disabled:opacity-40`,children:`+ 新建`})]}),(0,m.jsxs)(`div`,{className:`flex-1 overflow-y-auto py-2 px-1 space-y-1`,children:[(0,m.jsx)(`div`,{className:`group flex items-center rounded-md ${C===`.`?`bg-[#e8f0fe]`:`hover:bg-stone-100`}`,style:{paddingLeft:8},children:(0,m.jsxs)(`button`,{type:`button`,onClick:()=>{q(`.`),Oe()},"aria-expanded":O,className:`flex-1 min-w-0 flex items-center gap-1.5 py-1.5 pr-1 text-sm text-left ${C===`.`?`text-[#4176e6]`:`text-stone-600`}`,children:[(0,m.jsx)(h,{open:O,className:`w-3.5 h-3.5 shrink-0 text-[#4176e6]`}),(0,m.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:`全部需求`}),(0,m.jsxs)(`span`,{className:`shrink-0 tabular-nums text-[11px] text-stone-400`,children:[`(`,ye,`)`]})]})}),(0,m.jsx)(`div`,{className:`tw-collapse ${O?`is-open`:``}`,children:(0,m.jsx)(`div`,{className:`tw-collapse-inner space-y-1`,children:S.map(e=>(0,m.jsx)(v,{node:e,depth:0,activePath:C,expanded:xe,globalOpen:O,onToggle:e=>D(t=>({...t,[e]:!(t[e]??O)})),onSelect:e=>void q(e)},e.path))})})]})]}),(0,m.jsxs)(`section`,{className:`flex-1 min-w-0 rounded-xl border border-stone-200 bg-white flex flex-col overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,m.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0 truncate`,children:[(0,m.jsx)(`span`,{className:`text-stone-400`,children:pe(`requirements`)}),C===`.`?``:C]}),(0,m.jsx)(`input`,{ref:U,type:`file`,multiple:!0,accept:`.md,.txt,.docx,.xlsx,.xls,.csv,text/plain,text/markdown,text/csv,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel`,className:`hidden`,onChange:e=>void je(e.target.files)}),(0,m.jsx)(`button`,{type:`button`,disabled:j,onClick:()=>U.current?.click(),className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40`,children:`上传文件`})]}),k?(0,m.jsx)(`div`,{className:`mx-4 mt-3 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:k}):null,(0,m.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-4`,children:[Z.length>0&&(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`text-xs font-medium text-stone-400 mb-2`,children:`子文件夹`}),(0,m.jsx)(`ul`,{className:`space-y-1`,children:Z.map(e=>(0,m.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg border border-stone-100 hover:bg-stone-50`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`flex-1 min-w-0 flex items-center gap-2 text-left text-sm text-stone-700`,onClick:()=>void q(e.path),children:[(0,m.jsx)(h,{className:`w-4 h-4 text-[#4176e6] shrink-0`}),(0,m.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,"data-hint":e.name,children:e.name})]}),(0,m.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`重命名 ${e.name}`,onClick:()=>Y({name:e.name,path:e.path},!0),className:`p-1.5 rounded text-stone-400 hover:text-[#4176e6] hover:bg-[#e8f0fe] disabled:opacity-40`,children:(0,m.jsx)(g,{className:`w-3.5 h-3.5`})}),(0,m.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`删除 ${e.name}`,onClick:()=>Me({name:e.name,path:e.path}),className:`tw-icon-danger p-1.5 rounded`,children:(0,m.jsx)(_,{className:`w-3.5 h-3.5`})})]},e.path))})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`text-xs font-medium text-stone-400 mb-2`,children:`文件`}),X.length===0?(0,m.jsx)(`p`,{className:`text-sm text-stone-400 py-6 text-center border border-dashed border-stone-200 rounded-lg`,children:`当前文件夹为空,点击「上传文件」添加需求文档(.md / .txt / .docx / .xlsx / .csv)`}):(0,m.jsx)(`ul`,{className:`${De}space-y-1`,children:Le.map(e=>{let t=Ee===e.path;return(0,m.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors ${t?`border-[#c7dcff] bg-[#e8f0fe]`:`border-stone-100 hover:bg-stone-50`}`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`flex-1 min-w-0 text-left`,onClick:()=>{H(e.path),Ie(e)},onDoubleClick:t=>{t.preventDefault(),Ae(e)},children:[(0,m.jsx)(`div`,{className:`text-sm text-stone-800 truncate`,"data-hint":e.name,children:e.name}),(0,m.jsxs)(`div`,{className:`text-[11px] text-stone-400`,children:[he(e.size),e.ctime||e.mtime?` · ${me(e.ctime??e.mtime)}`:``]})]}),(0,m.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`重命名 ${e.name}`,onClick:()=>Y({name:e.name,path:e.path},!1),className:`p-1.5 rounded text-stone-400 hover:text-[#4176e6] hover:bg-[#e8f0fe] disabled:opacity-40`,children:(0,m.jsx)(g,{className:`w-3.5 h-3.5`})}),(0,m.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`删除 ${e.name}`,onClick:()=>J(e),className:`tw-icon-danger p-1.5 rounded`,children:(0,m.jsx)(_,{className:`w-3.5 h-3.5`})})]},e.path)})})]}),N?(0,m.jsxs)(`div`,{className:`rounded-lg border border-stone-200 overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`px-3 py-2 bg-stone-50 border-b border-stone-200 flex items-center justify-between`,children:[(0,m.jsx)(`span`,{className:`text-xs text-stone-500 truncate`,children:N.path}),(0,m.jsx)(`button`,{type:`button`,className:`text-xs text-stone-500 hover:text-stone-800`,onClick:()=>P(null),children:`关闭预览`})]}),(0,m.jsx)(`pre`,{className:`max-h-80 overflow-auto p-4 text-xs leading-5 text-stone-700 whitespace-pre-wrap bg-white`,children:N.content})]}):null]}),X.length>0?(0,m.jsx)(ee,{page:$,totalPages:Q,pageSize:V,busy:j,onPage:e=>{W(),B(e)},onPageSize:Re}):null]}),(0,m.jsx)(f,{open:Ce,title:`新建文件夹`,onClose:()=>F(!1),onConfirm:e=>void ke(e)}),(0,m.jsx)(f,{open:R!=null,title:R?.isDir?`重命名文件夹`:`重命名文件`,label:R?.isDir?`文件夹名称`:`文件名称`,initialValue:R?.name??``,lockExtension:R!=null&&!R.isDir,confirmLabel:`保存`,onClose:()=>z(null),onConfirm:e=>void Pe(e)}),(0,m.jsx)(s,{open:I!=null,title:I?.blocked?`无法删除文件夹`:I?.isDir?`删除文件夹`:`删除需求文件`,message:Fe,confirmLabel:I?.blocked?`知道了`:`删除`,cancelLabel:`取消`,danger:!I?.blocked,hideCancel:!!I?.blocked,onClose:()=>L(null),onConfirm:()=>void Ne()})]})}export{y as default};
|