lantern-harness 0.1.22 → 0.1.24
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 +47 -0
- package/builtin/session/bash-session.mjs +91 -0
- package/builtin/session/lh-bash.mjs +67 -1
- package/builtin/session/lh-web.mjs +103 -52
- package/builtin/session/mcp-client.mjs +290 -0
- package/builtin/session/pwsh-session.mjs +90 -0
- package/builtin/session/session-runs.mjs +6 -1
- package/builtin/session/tool-run-policy.mjs +32 -0
- package/builtin/session/web-fetch-policy.mjs +79 -0
- package/cli/acp-server.mjs +19 -9
- package/cli/agent-policy.mjs +60 -0
- package/cli/headless.mjs +30 -6
- package/cli/jsonrpc-server.mjs +9 -3
- package/cli/lantern.mjs +40 -5
- package/cli/server.mjs +2 -0
- package/dist/500.html +4 -4
- package/dist/_astro/Base.astro_astro_type_script_index_0_lang.DHRjA0au.js +2 -0
- package/dist/_astro/Base.nGl8De0W.css +1 -0
- package/dist/_astro/{CaseExecBoard.Dnb8oP5i.js → CaseExecBoard.Xd7KUpkU.js} +1 -1
- package/dist/_astro/{CaseGenerateApp.ci_JowEk.js → CaseGenerateApp.BgIi4YGn.js} +2 -2
- package/dist/_astro/CasesLibrary.B2VCAoTt.js +21 -0
- package/dist/_astro/ChatApp.CeSatNSf.js +220 -0
- package/dist/_astro/ConfirmDialog.D5qXeML0.js +1 -0
- package/dist/_astro/{DashboardBoard.D8-oufgg.js → DashboardBoard.CmxqpmzI.js} +2 -2
- package/dist/_astro/DocsFileBrowser.Diq5zuSt.js +1 -0
- package/dist/_astro/{DocsPager.B9VhI6E3.js → DocsPager.WMztSW4O.js} +1 -1
- package/dist/_astro/{KnowledgeLibrary.DGhU2p3S.js → KnowledgeLibrary.CYutSepl.js} +1 -1
- package/dist/_astro/MultiSelectDropdown.BHxW9XLR.js +1 -0
- package/dist/_astro/NamePromptDialog.5XFIvdqv.js +1 -0
- package/dist/_astro/{NavLibraries.RH3Sinuh.js → NavLibraries.BybmHnXn.js} +1 -1
- package/dist/_astro/{PluginsPage.DjeMQX3i.js → PluginsPage.CgcXB7Ap.js} +2 -2
- package/dist/_astro/PluginsPage.pgN80K8r.js +1 -0
- package/dist/_astro/{PmBugsBoard.BnnaNP1y.js → PmBugsBoard.Ceyt3pp6.js} +1 -1
- package/dist/_astro/{PmIterationsBoard.phiyhQVA.js → PmIterationsBoard.Dwsntvw6.js} +1 -1
- package/dist/_astro/{PmProjectDetail.C8kRX5lu.js → PmProjectDetail.5tybGC46.js} +1 -1
- package/dist/_astro/{PmProjectsBoard.CFApEGPo.js → PmProjectsBoard.X2LZfFff.js} +1 -1
- package/dist/_astro/{PmRequirementsBoard.DR9egcgA.js → PmRequirementsBoard.CXaGeFl9.js} +1 -1
- package/dist/_astro/PmRequirementsBoard.CYbicBqS.js +1 -0
- package/dist/_astro/{PmShared.BrBicDMN.js → PmShared.Bzn6AGsN.js} +1 -1
- package/dist/_astro/PromptMountDialog.CpTT6L0a.js +62 -0
- package/dist/_astro/{PromptsLibrary.CbGja6mq.js → PromptsLibrary.DydrgeIw.js} +1 -1
- package/dist/_astro/{ReportsPage.CYZtpeiv.js → ReportsPage.BRVCnzL-.js} +1 -1
- package/dist/_astro/ReqAnalysisBoard.BCq_OoRo.js +39 -0
- package/dist/_astro/RequirementsLibrary.DtbFESBh.js +1 -0
- package/dist/_astro/SearchableSelect.D3ODywC4.js +1 -0
- package/dist/_astro/SettingsDialog.DtEJLxtx.js +1 -0
- package/dist/_astro/SpaceSwitcher.Cdveup1T.js +7 -0
- package/dist/_astro/{TasksBoard.D0HwS5hd.js → TasksBoard.rwdPWLAh.js} +1 -1
- package/dist/_astro/{TemplatesLibrary.CVv5Ef30.js → TemplatesLibrary.Bg-MFL57.js} +1 -1
- package/dist/_astro/{TestStatsBoard._qNcNorG.js → TestStatsBoard.eiMbNGpn.js} +1 -1
- package/dist/_astro/{TodosBoard.CF5wbJy7.js → TodosBoard.CrZMl6Ei.js} +1 -1
- package/dist/_astro/{UiAutoBoard.nrtcQJDl.js → UiAutoBoard.CLi9vmuE.js} +3 -3
- package/dist/_astro/{app-config.CF1xVPmo.js → app-config.DAIyT--R.js} +1 -1
- package/dist/_astro/app-version.XPYyWuno.js +1 -0
- package/dist/_astro/bash-tools.D4DBYc9k.js +27 -0
- package/dist/_astro/case-fields.Dqkws1iX.js +1 -0
- package/dist/_astro/case-gen-run.BbI2iGo9.js +21 -0
- package/dist/_astro/case-review.D1E3ldss.js +3 -0
- package/dist/_astro/{case-types.DS1EQ5yP.js → case-types.B6MLX3iE.js} +1 -1
- package/dist/_astro/docs-format.BlGh-XA_.js +1 -0
- package/dist/_astro/{hydrate-cache.CmC22o_H.js → hydrate-cache.C0F0L04c.js} +1 -1
- package/dist/_astro/i18n.ele1lM9e.js +7 -0
- package/dist/_astro/open-docs-in-session.D608wzlx.js +1 -0
- package/dist/_astro/{plugins.CVM1IaoC.js → plugins.Di6uuouN.js} +1 -1
- package/dist/_astro/req-analysis.CIZ_cIJQ.js +23 -0
- package/dist/_astro/settings.DbhUT6Ao.js +2 -0
- package/dist/_astro/{spaces-client.DnS6MgGy.js → spaces-client.OuJPy3GP.js} +1 -1
- package/dist/_astro/{story-review.E_go1fvj.js → story-review.BRcUdixS.js} +6 -3
- package/dist/_astro/{view-prefs.D1snIG5o.js → view-prefs.DkS1ldnh.js} +1 -1
- package/dist/case-exec/index.html +5 -5
- package/dist/cases/generate/index.html +5 -5
- package/dist/cases/library/index.html +5 -5
- package/dist/dashboard/index.html +5 -5
- package/dist/docs/changelog/index.html +48 -5
- package/dist/docs/install/index.html +48 -4
- package/dist/docs/manual/index.html +41 -33
- package/dist/knowledge/index.html +5 -5
- package/dist/plugins/index.html +5 -5
- package/dist/pm/bugs/index.html +5 -5
- package/dist/pm/iterations/index.html +5 -5
- package/dist/pm/projects/detail/index.html +5 -5
- package/dist/pm/projects/index.html +5 -5
- package/dist/pm/requirements/index.html +5 -5
- package/dist/prompts/index.html +5 -5
- package/dist/reports/index.html +5 -5
- package/dist/requirement-analysis/index.html +5 -5
- package/dist/requirements/index.html +5 -5
- package/dist/tasks/index.html +5 -5
- package/dist/templates/index.html +5 -5
- package/dist/test-automation/index.html +5 -5
- package/dist/test-stats/index.html +5 -5
- package/dist/todos/index.html +5 -5
- package/dist/workbench/index.html +5 -5
- package/docs//344/274/232/350/257/235/346/217/222/344/273/266.md +9 -7
- package/docs//345/205/250/345/261/200/346/217/222/344/273/266.md +14 -2
- package/docs//345/256/211/350/243/205/346/211/213/345/206/214.md +23 -0
- package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +36 -27
- package/lh-plugins/case-review-prompt.mjs +12 -106
- package/lh-plugins/lh-case-review.mjs +3 -0
- package/lh-plugins/lh-mcp.mjs +79 -0
- package/lh-plugins/lh-reports.mjs +11 -28
- package/lh-plugins/lh-req-analysis.mjs +59 -6
- package/lh-plugins/req-analysis-prompt.mjs +34 -44
- package/lh-plugins/story-review-prompt.mjs +8 -52
- package/lh-plugins/uiauto-prompt.mjs +9 -65
- package/package.json +3 -1
- package/dist/_astro/Base.I--fR8aT.css +0 -1
- package/dist/_astro/Base.astro_astro_type_script_index_0_lang.BQtZbum2.js +0 -1
- package/dist/_astro/CasesLibrary.DfuTkbJN.js +0 -21
- package/dist/_astro/ChatApp.CAgrwilW.js +0 -214
- package/dist/_astro/ConfirmDialog.CsMwWevK.js +0 -1
- package/dist/_astro/DocsFileBrowser.CTICuWFf.js +0 -1
- package/dist/_astro/NamePromptDialog.CS1pTTVl.js +0 -1
- package/dist/_astro/PluginsPage.C9vaY-lo.js +0 -1
- package/dist/_astro/PmRequirementsBoard.B-AI9iZX.js +0 -1
- package/dist/_astro/PromptMountDialog.YH2odDZx.js +0 -58
- package/dist/_astro/ReqAnalysisBoard.By08xNFf.js +0 -29
- package/dist/_astro/RequirementsLibrary.BSDgdppH.js +0 -1
- package/dist/_astro/SearchableSelect.Cbb8jMnP.js +0 -1
- package/dist/_astro/SettingsDialog.DgpH_BVN.js +0 -1
- package/dist/_astro/SpaceSwitcher.Dw9LjKiJ.js +0 -7
- package/dist/_astro/app-version.5UudQEyk.js +0 -1
- package/dist/_astro/bash-tools.CPS0ZiKi.js +0 -25
- package/dist/_astro/case-fields.h0roo2br.js +0 -1
- package/dist/_astro/case-gen-run.D8DGX0mr.js +0 -19
- package/dist/_astro/case-review.C1hQRbQ2.js +0 -3
- package/dist/_astro/i18n.CjqQGCAI.js +0 -7
- package/dist/_astro/open-docs-in-session.Cj0J2-XT.js +0 -1
- package/dist/_astro/req-analysis.dhgy4p2f.js +0 -14
- package/dist/_astro/settings.B1yetppp.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{s as n}from"./plugins.CVM1IaoC.js";import{t as r}from"./jsx-runtime.DUg_B_vD.js";import{t as i}from"./ConfirmDialog.CsMwWevK.js";import{c as a,d as ee,i as o,l as s,n as c,o as te,r as l,s as ne,t as u}from"./ColumnResize.BgYkV9Iy.js";import{n as d,t as f}from"./DocsPager.B9VhI6E3.js";import{t as p}from"./SelectDropdown.apWlFGbA.js";import{showToast as m}from"./Toast.BO2NFckG.js";import{A as h,C as re,E as g,L as _,N as ie,P as ae,R as v,d as y,f as oe,g as se,h as ce,k as b,l as x,m as le,u as ue}from"./pm.pMOkNqqK.js";import{A as de,C as fe,D as pe,E as me,O as S,S as he,T as C,_ as w,a as ge,c as _e,d as ve,f as T,g as ye,h as E,k as be,l as xe,m as D,p as Se,s as O,u as Ce,w as we,y as k}from"./PmShared.BrBicDMN.js";var A=e(t(),1),j=r();function Te({value:e,onChange:t,entity:n,recordId:r=``,seenUrls:i,onError:a,onPersisted:ee}){let o=h(e),[s,c]=(0,A.useState)(!1),[te,l]=(0,A.useState)(!1),[ne,u]=(0,A.useState)(null),d=(0,A.useRef)(null);(0,A.useEffect)(()=>{for(let t of h(e))i.current.add(t.url)},[e,i]);let f=(0,A.useCallback)(async n=>{if(n&&n.length){c(!0);try{let r=await v(Array.from(n));t(b([...h(e),...r])),a(``)}catch(e){a(e instanceof Error?e.message:String(e))}finally{c(!1),d.current&&(d.current.value=``)}}},[t,a,e]);(0,A.useEffect)(()=>{let e=e=>{let t=Array.from(e.clipboardData?.files??[]);t.length&&(e.preventDefault(),f(t))};return window.addEventListener(`paste`,e),()=>window.removeEventListener(`paste`,e)},[f]);async function p(e){let i=b(o.filter(t=>t.url!==e));if(r)try{await _(n,r,{attachment:i}),ee?.()}catch(e){a(e instanceof Error?e.message:String(e));return}t(i),le([e],r)}return(0,j.jsxs)(`div`,{className:`space-y-2 rounded-lg transition-colors ${te?`bg-[#3370ff]/5 ring-1 ring-[#3370ff]/40`:``}`,onDragOver:e=>{e.preventDefault(),l(!0)},onDragLeave:()=>l(!1),onDrop:e=>{e.preventDefault(),l(!1),f(e.dataTransfer?.files??null)},children:[o.length?(0,j.jsx)(`ul`,{className:`space-y-1.5`,children:o.map(e=>(0,j.jsxs)(`li`,{className:`flex items-center gap-2 rounded-lg border border-stone-200 px-2 py-1.5`,children:[g(e.url)?(0,j.jsx)(`button`,{type:`button`,onClick:()=>u(e),"aria-label":`预览附件 ${e.name}`,className:`shrink-0 cursor-zoom-in`,children:(0,j.jsx)(`img`,{src:e.url,alt:e.name,className:`h-9 w-9 rounded-md border border-stone-100 object-cover`})}):(0,j.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-stone-100 text-stone-400`,children:(0,j.jsx)(D,{name:`file`,size:15})}),g(e.url)?(0,j.jsx)(`button`,{type:`button`,onClick:()=>u(e),className:`min-w-0 flex-1 truncate text-left text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}):(0,j.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`min-w-0 flex-1 truncate text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}),(0,j.jsx)(`button`,{type:`button`,"aria-label":`移除附件 ${e.name}`,onClick:()=>void p(e.url),className:`tw-icon-danger flex h-6 w-6 shrink-0 items-center justify-center rounded`,children:`✕`})]},e.url))}):null,(0,j.jsx)(`input`,{ref:d,type:`file`,multiple:!0,className:`hidden`,onChange:e=>void f(e.target.files)}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,j.jsxs)(`button`,{type:`button`,disabled:s,onClick:()=>d.current?.click(),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-dashed border-stone-300 px-2.5 text-xs text-stone-500 transition-colors hover:border-stone-400 hover:text-stone-700 disabled:opacity-40`,children:[(0,j.jsx)(D,{name:s?`file`:`plus`,size:13}),s?`上传中…`:`上传文件 / 图片`]}),(0,j.jsx)(`span`,{className:`text-xs text-stone-400`,children:`可拖拽到这里,或直接粘贴截图(⌘V / Ctrl+V),支持多张`})]}),(0,j.jsx)(E,{file:ne,onClose:()=>u(null)})]})}var Ee=[{key:`id`,width:88,min:72},{key:`title`,width:280,min:160},{key:`priority`,width:100,min:80},{key:`status`,width:120,min:96}],De={key:`project`,width:140,min:100},Oe=[{key:`iteration`,width:120,min:88},{key:`filler`,filler:!0},{key:`action`,width:76,min:64}],ke=20,Ae=`tw.pm-requirements.page-size.v1`,je=[`all`,...y],Me=[`all`,...x],Ne=`pm.requirements.project`,Pe=`pm.requirements.iteration`,Fe=`pm.requirements.status`,Ie=`pm.requirements.priority`,Le=`pm.requirements.keyword`,Re=x.map(e=>({value:e,label:ue[e]})),M=y.map(e=>({value:e,label:oe[e]}));function ze(e=``){return{projectId:e,iterationId:``,title:``,priority:`medium`,status:`pending`,description:``,acceptanceCriteria:[],githubIssue:``,attachment:``}}function N({scopeProjectId:e=``}={}){let t=!!e,r=be(`pmRequirements`),{store:g,live:v,loading:y,error:b,setError:x,reload:E}=de(),[N,P]=S(Ne,`all`),F=e||N,[I,L]=S(Pe,`all`),[R,Be]=pe(Fe,je,`all`),[z,Ve]=pe(Ie,Me,`all`),[B,He]=S(Le),[Ue,V]=(0,A.useState)(1),[H,We]=d(ke,Ae),[U,W]=(0,A.useState)(null),[G,K]=(0,A.useState)(!1),[q,J]=(0,A.useState)(null),Y=(0,A.useRef)(new Set),X=(0,A.useMemo)(()=>t?[...Ee,...Oe]:[...Ee,De,...Oe],[t]),Z=s(t?`pm.requirements.cols.scoped.v1`:`pm.requirements.cols.v1`,X),Ge=ee(t?`pm.requirements.scroll.scoped`:`pm.requirements.scroll`),Ke=Z.widthOf(`id`)??88,qe=(0,A.useMemo)(()=>[{value:`all`,label:`全部项目`},...g.projects.map(e=>({value:e.id,label:e.name}))],[g.projects]),Je=(0,A.useMemo)(()=>[{value:`all`,label:`全部迭代`},...ie(g.iterations.filter(e=>F===`all`||e.projectId===F)).map(e=>({value:e.id,label:e.name}))],[g.iterations,F]),Ye=(0,A.useMemo)(()=>{let e=new Map(g.projects.map(e=>[e.id,e.name]));return t=>e.get(t)??`—`},[g.projects]),Xe=(0,A.useMemo)(()=>{let e=new Map(g.iterations.map(e=>[e.id,e.name]));return t=>t?e.get(t)??`—`:`—`},[g.iterations]),Q=(0,A.useMemo)(()=>ae(re(g.requirements,{projectId:F,iterationId:I,status:R,priority:z,keyword:B})),[g.requirements,F,I,R,z,B]),$=t?g.requirements.filter(e=>e.projectId===F).length:g.requirements.length,Ze=Math.max(1,Math.ceil(Q.length/H)),Qe=Math.min(Ue,Ze),$e=Q.slice((Qe-1)*H,Qe*H);(0,A.useEffect)(()=>{t||v===!0&&N!==`all`&&!g.projects.some(e=>e.id===N)&&P(`all`)},[v,g.projects,N,P,t]),(0,A.useEffect)(()=>{v===!0&&I!==`all`&&!g.iterations.some(e=>e.id===I&&(F===`all`||e.projectId===F))&&L(`all`)},[v,g.iterations,F,I,L]);let et=U?ie(g.iterations.filter(e=>e.projectId===U.projectId)):[];async function tt(){if(!U)return;if(!U.projectId){x(`请先选择所属项目`);return}let e=U.title.trim();if(!e)x(`需求描述不能为空`);else{K(!0);try{let t={projectId:U.projectId,iterationId:U.iterationId,title:e,priority:U.priority,status:U.status,description:U.description,acceptanceCriteria:U.acceptanceCriteria.filter(e=>e.text.trim()),githubIssue:U.githubIssue,attachment:U.attachment};U.id?await _(`requirements`,U.id,t):await ce(`requirements`,[t]);let n=!!U.id;W(null),Y.current.clear(),x(``),await E(!0),m(n?`已保存需求`:`已新建需求`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);x(t),m(`保存需求失败:${t}`,`error`)}finally{K(!1)}}}function nt(){let e=[...Y.current,...h(U?.attachment??``).map(e=>e.url)];Y.current.clear(),W(null),e.length&&le(e)}async function rt(e,t){K(!0);try{await _(`requirements`,e.id,{status:t}),await E(!0),m(`已更新需求状态为「${t}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);x(t),m(`更新状态失败:${t}`,`error`)}finally{K(!1)}}async function it(){let e=q;if(e){J(null),K(!0);try{await se(`requirements`,[e.id]),await E(!0),m(`已删除需求`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);x(t),m(`删除需求失败:${t}`,`error`)}finally{K(!1)}}}if(!r.ready)return(0,j.jsx)(ye,{label:`正在读取插件开关`});if(!r.on)return(0,j.jsx)(w,{children:n(`pmRequirements`)});if(v===null)return(0,j.jsx)(ye,{label:`正在连接项目管理服务`});if(!v)return(0,j.jsx)(w,{children:`需求管理需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`});if(g.projects.length===0&&!y&&!t)return(0,j.jsx)(w,{children:`还没有项目。请先在「项目列表」里新建一个项目,再回来维护需求。`});let at=[{value:`all`,label:`全部`},...M];return(0,j.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,j.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,j.jsxs)(`div`,{className:`text-xs text-stone-400`,children:[`共 `,(0,j.jsx)(`span`,{className:`font-medium text-stone-600`,children:$}),` 条需求`,Q.length===$?``:` · 筛选出 ${Q.length} 条`]}),(0,j.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[t?null:(0,j.jsx)(p,{flat:!0,showCheck:!1,ariaLabel:`按项目筛选需求`,className:`w-36`,options:qe,value:N,onChange:e=>{P(e),L(`all`),V(1)}}),(0,j.jsx)(p,{flat:!0,showCheck:!1,ariaLabel:`按迭代筛选需求`,className:`w-32`,options:Je,value:I,onChange:e=>{L(e),V(1)}}),(0,j.jsx)(p,{flat:!0,showCheck:!1,ariaLabel:`按优先级筛选需求`,className:`w-28`,options:[{value:`all`,label:`全部优先级`},...Re],value:z,onChange:e=>{Ve(e),V(1)}}),(0,j.jsxs)(`label`,{className:`relative block`,children:[(0,j.jsx)(D,{name:`search`,size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-stone-400`}),(0,j.jsx)(`input`,{value:B,onChange:e=>{He(e.target.value),V(1)},placeholder:`搜索编号 / 名称…`,className:`h-9 w-44 rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff]`})]}),(0,j.jsxs)(`button`,{type:`button`,disabled:G,onClick:()=>W(ze(F===`all`?``:F)),className:`inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white transition-colors hover:bg-[#2b5fd9] disabled:opacity-40`,children:[(0,j.jsx)(D,{name:`plus`,size:14}),`新建需求`]})]})]}),(0,j.jsx)(`div`,{className:`mt-3 flex shrink-0 flex-wrap items-center gap-2`,children:(0,j.jsx)(Se,{ariaLabel:`按状态筛选需求`,options:at,value:R,onChange:e=>{Be(e),V(1)}})}),b?(0,j.jsx)(ve,{message:b,onClose:()=>x(``)}):null,(0,j.jsxs)(`div`,{className:`mt-3 flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,j.jsx)(`div`,{ref:Ge,className:`tw-scroll-x min-h-0 flex-1 overflow-auto`,children:(0,j.jsxs)(`table`,{className:`tw-data-table tw-sticky-table w-full table-fixed text-sm`,style:Z.tableStyle,children:[(0,j.jsx)(`colgroup`,{children:X.map(e=>(0,j.jsx)(`col`,{style:Z.widthOf(e.key)?{width:Z.widthOf(e.key)}:void 0},e.key))}),(0,j.jsx)(`thead`,{className:`tw-table-head sticky top-0 z-10 text-xs text-stone-500`,children:(0,j.jsxs)(`tr`,{children:[(0,j.jsxs)(`th`,{className:`${ne} relative`,children:[`ID`,(0,j.jsx)(u,{...Z.resizeProps(`id`)})]}),(0,j.jsxs)(`th`,{className:te,style:{"--tw-sticky-left":`${Ke}px`},children:[`需求描述`,(0,j.jsx)(u,{...Z.resizeProps(`title`)})]}),(0,j.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`优先级`,(0,j.jsx)(u,{...Z.resizeProps(`priority`)})]}),(0,j.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`需求状态`,(0,j.jsx)(u,{...Z.resizeProps(`status`)})]}),t?null:(0,j.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`所属项目`,(0,j.jsx)(u,{...Z.resizeProps(`project`)})]}),(0,j.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`所属迭代`,(0,j.jsx)(u,{...Z.resizeProps(`iteration`)})]}),(0,j.jsx)(`th`,{"aria-hidden":`true`}),(0,j.jsx)(`th`,{className:a,children:`操作`})]})}),(0,j.jsxs)(`tbody`,{children:[y&&!g.requirements.length?(0,j.jsx)(`tr`,{children:(0,j.jsx)(`td`,{colSpan:X.length,className:`px-4 py-16 text-center`,children:(0,j.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):$e.length===0?(0,j.jsx)(`tr`,{children:(0,j.jsx)(`td`,{colSpan:X.length,children:$?(0,j.jsx)(xe,{children:`没有符合筛选条件的需求。`}):(0,j.jsx)(Ce,{icon:`file`,title:`暂无需求`,hint:`拆出第一条需求,再关联迭代、补充描述。`,action:(0,j.jsxs)(`button`,{type:`button`,onClick:()=>W(ze(F===`all`?``:F)),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-stone-200 px-3 text-xs text-stone-600 transition-colors hover:bg-stone-50`,children:[(0,j.jsx)(D,{name:`plus`,size:13}),`新建需求`]})})})}):null,$e.map(e=>(0,j.jsxs)(`tr`,{className:`border-t border-stone-100 hover:bg-[#f7f8fa]`,children:[(0,j.jsx)(`td`,{className:`${l} font-mono text-xs text-stone-400`,children:e.autoId}),(0,j.jsx)(`td`,{className:c,style:{"--tw-sticky-left":`${Ke}px`},children:(0,j.jsx)(fe,{text:e.title,onClick:()=>W({id:e.id,projectId:e.projectId,iterationId:e.iterationId,title:e.title,priority:e.priority,status:e.status,description:e.description,acceptanceCriteria:e.acceptanceCriteria.map(e=>({...e})),githubIssue:e.githubIssue,attachment:e.attachment})})}),(0,j.jsx)(`td`,{className:`px-2 py-1 align-middle`,children:(0,j.jsx)(he,{tone:we[e.priority],children:ue[e.priority]})}),(0,j.jsx)(`td`,{className:`min-w-0 overflow-hidden px-2 py-1 align-middle`,children:(0,j.jsx)(p,{unstyled:!0,hideChevron:!0,ariaLabel:`修改 ${e.title} 的状态`,disabled:G,options:M,value:e.status,onChange:t=>void rt(e,t),renderOptionPrefix:e=>(0,j.jsx)(O,{tone:C[e.value]}),renderTrigger:()=>(0,j.jsx)(he,{tone:C[e.status],children:oe[e.status]})})}),t?null:(0,j.jsx)(`td`,{className:`min-w-0 truncate px-2 py-1 align-middle text-sm text-stone-600`,children:(0,j.jsx)(`a`,{href:me(e.projectId),className:`block truncate transition-colors hover:text-[#3370ff]`,children:Ye(e.projectId)})}),(0,j.jsx)(`td`,{className:`min-w-0 truncate px-2 py-1 align-middle text-sm text-stone-500`,children:Xe(e.iterationId)}),(0,j.jsx)(`td`,{"aria-hidden":`true`}),(0,j.jsx)(`td`,{className:o,children:(0,j.jsx)(`button`,{type:`button`,"aria-label":`删除 ${e.title}`,disabled:G,onClick:()=>J(e),className:`tw-icon-danger inline-flex h-7 w-7 items-center justify-center rounded-md`,children:(0,j.jsx)(D,{name:`trash`,size:15})})})]},e.id))]})]})}),Q.length>0?(0,j.jsx)(f,{page:Qe,totalPages:Ze,pageSize:H,busy:G,onPage:V,onPageSize:e=>{We(e),V(1)}}):null]}),(0,j.jsx)(_e,{open:U!==null,title:U?.id?`编辑需求`:`新建需求`,busy:G,submitLabel:U?.id?`保存`:`创建`,onClose:()=>nt(),onSubmit:()=>void tt(),children:U?(0,j.jsxs)(`div`,{className:`space-y-1`,children:[t?null:(0,j.jsx)(T,{label:`所属项目`,required:!0,children:(0,j.jsx)(k,{ariaLabel:`所属项目`,options:g.projects.map(e=>({value:e.id,label:e.name})),value:U.projectId,onChange:e=>{let t=g.iterations.some(t=>t.id===U.iterationId&&t.projectId===e);W({...U,projectId:e,iterationId:t?U.iterationId:``})}})}),(0,j.jsx)(T,{label:`所属迭代`,children:(0,j.jsx)(k,{ariaLabel:`所属迭代`,options:[{value:``,label:`不关联迭代`},...et.map(e=>({value:e.id,label:e.name}))],value:U.iterationId,onChange:e=>W({...U,iterationId:e}),disabled:et.length===0})}),(0,j.jsx)(T,{label:`需求描述`,required:!0,children:(0,j.jsx)(`textarea`,{autoFocus:!0,value:U.title,onChange:e=>W({...U,title:e.target.value}),placeholder:`一句话写清要做什么`,rows:3,className:ge})}),(0,j.jsx)(T,{label:`优先级`,children:(0,j.jsx)(k,{ariaLabel:`优先级`,options:Re,value:U.priority,onChange:e=>W({...U,priority:e}),renderOptionPrefix:e=>(0,j.jsx)(O,{tone:we[e.value]})})}),(0,j.jsx)(T,{label:`需求状态`,children:(0,j.jsx)(k,{ariaLabel:`需求状态`,options:M,value:U.status,onChange:e=>W({...U,status:e}),renderOptionPrefix:e=>(0,j.jsx)(O,{tone:C[e.value]})})}),(0,j.jsx)(T,{label:`附件`,children:(0,j.jsx)(Te,{value:U.attachment,onChange:e=>W(t=>t&&{...t,attachment:e}),entity:`requirements`,recordId:U.id??``,seenUrls:Y,onError:x,onPersisted:()=>void E(!0)})}),(0,j.jsx)(T,{label:`备注`,children:(0,j.jsx)(`textarea`,{value:U.description,onChange:e=>W({...U,description:e.target.value}),placeholder:`补充背景、目标与范围(可选)`,rows:4,className:ge})})]}):null}),(0,j.jsx)(i,{open:q!==null,title:`删除需求`,message:`确定删除「${q?.title??``}」?关联的缺陷会保留,但不再关联到这条需求。`,confirmLabel:`删除`,danger:`solid`,onClose:()=>J(null),onConfirm:()=>void it()})]})}export{N as t};
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{s as n}from"./plugins.Di6uuouN.js";import{t as r}from"./jsx-runtime.DUg_B_vD.js";import{t as i}from"./ConfirmDialog.D5qXeML0.js";import{c as a,d as ee,i as o,l as s,n as c,o as te,r as l,s as ne,t as u}from"./ColumnResize.BgYkV9Iy.js";import{n as d,t as f}from"./DocsPager.WMztSW4O.js";import{t as p}from"./SelectDropdown.apWlFGbA.js";import{showToast as m}from"./Toast.BO2NFckG.js";import{A as h,C as re,E as g,L as _,N as ie,P as ae,R as v,d as y,f as oe,g as se,h as ce,k as b,l as x,m as le,u as ue}from"./pm.pMOkNqqK.js";import{A as de,C as fe,D as pe,E as me,O as S,S as he,T as C,_ as w,a as ge,c as _e,d as ve,f as T,g as ye,h as E,k as be,l as xe,m as D,p as Se,s as O,u as Ce,w as we,y as k}from"./PmShared.Bzn6AGsN.js";var A=e(t(),1),j=r();function Te({value:e,onChange:t,entity:n,recordId:r=``,seenUrls:i,onError:a,onPersisted:ee}){let o=h(e),[s,c]=(0,A.useState)(!1),[te,l]=(0,A.useState)(!1),[ne,u]=(0,A.useState)(null),d=(0,A.useRef)(null);(0,A.useEffect)(()=>{for(let t of h(e))i.current.add(t.url)},[e,i]);let f=(0,A.useCallback)(async n=>{if(n&&n.length){c(!0);try{let r=await v(Array.from(n));t(b([...h(e),...r])),a(``)}catch(e){a(e instanceof Error?e.message:String(e))}finally{c(!1),d.current&&(d.current.value=``)}}},[t,a,e]);(0,A.useEffect)(()=>{let e=e=>{let t=Array.from(e.clipboardData?.files??[]);t.length&&(e.preventDefault(),f(t))};return window.addEventListener(`paste`,e),()=>window.removeEventListener(`paste`,e)},[f]);async function p(e){let i=b(o.filter(t=>t.url!==e));if(r)try{await _(n,r,{attachment:i}),ee?.()}catch(e){a(e instanceof Error?e.message:String(e));return}t(i),le([e],r)}return(0,j.jsxs)(`div`,{className:`space-y-2 rounded-lg transition-colors ${te?`bg-[#3370ff]/5 ring-1 ring-[#3370ff]/40`:``}`,onDragOver:e=>{e.preventDefault(),l(!0)},onDragLeave:()=>l(!1),onDrop:e=>{e.preventDefault(),l(!1),f(e.dataTransfer?.files??null)},children:[o.length?(0,j.jsx)(`ul`,{className:`space-y-1.5`,children:o.map(e=>(0,j.jsxs)(`li`,{className:`flex items-center gap-2 rounded-lg border border-stone-200 px-2 py-1.5`,children:[g(e.url)?(0,j.jsx)(`button`,{type:`button`,onClick:()=>u(e),"aria-label":`预览附件 ${e.name}`,className:`shrink-0 cursor-zoom-in`,children:(0,j.jsx)(`img`,{src:e.url,alt:e.name,className:`h-9 w-9 rounded-md border border-stone-100 object-cover`})}):(0,j.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-stone-100 text-stone-400`,children:(0,j.jsx)(D,{name:`file`,size:15})}),g(e.url)?(0,j.jsx)(`button`,{type:`button`,onClick:()=>u(e),className:`min-w-0 flex-1 truncate text-left text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}):(0,j.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`min-w-0 flex-1 truncate text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}),(0,j.jsx)(`button`,{type:`button`,"aria-label":`移除附件 ${e.name}`,onClick:()=>void p(e.url),className:`tw-icon-danger flex h-6 w-6 shrink-0 items-center justify-center rounded`,children:`✕`})]},e.url))}):null,(0,j.jsx)(`input`,{ref:d,type:`file`,multiple:!0,className:`hidden`,onChange:e=>void f(e.target.files)}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,j.jsxs)(`button`,{type:`button`,disabled:s,onClick:()=>d.current?.click(),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-dashed border-stone-300 px-2.5 text-xs text-stone-500 transition-colors hover:border-stone-400 hover:text-stone-700 disabled:opacity-40`,children:[(0,j.jsx)(D,{name:s?`file`:`plus`,size:13}),s?`上传中…`:`上传文件 / 图片`]}),(0,j.jsx)(`span`,{className:`text-xs text-stone-400`,children:`可拖拽到这里,或直接粘贴截图(⌘V / Ctrl+V),支持多张`})]}),(0,j.jsx)(E,{file:ne,onClose:()=>u(null)})]})}var Ee=[{key:`id`,width:88,min:72},{key:`title`,width:280,min:160},{key:`priority`,width:100,min:80},{key:`status`,width:120,min:96}],De={key:`project`,width:140,min:100},Oe=[{key:`iteration`,width:120,min:88},{key:`filler`,filler:!0},{key:`action`,width:76,min:64}],ke=20,Ae=`tw.pm-requirements.page-size.v1`,je=[`all`,...y],Me=[`all`,...x],Ne=`pm.requirements.project`,Pe=`pm.requirements.iteration`,Fe=`pm.requirements.status`,Ie=`pm.requirements.priority`,Le=`pm.requirements.keyword`,Re=x.map(e=>({value:e,label:ue[e]})),M=y.map(e=>({value:e,label:oe[e]}));function ze(e=``){return{projectId:e,iterationId:``,title:``,priority:`medium`,status:`pending`,description:``,acceptanceCriteria:[],githubIssue:``,attachment:``}}function N({scopeProjectId:e=``}={}){let t=!!e,r=be(`pmRequirements`),{store:g,live:v,loading:y,error:b,setError:x,reload:E}=de(),[N,P]=S(Ne,`all`),F=e||N,[I,L]=S(Pe,`all`),[R,Be]=pe(Fe,je,`all`),[z,Ve]=pe(Ie,Me,`all`),[B,He]=S(Le),[Ue,V]=(0,A.useState)(1),[H,We]=d(ke,Ae),[U,W]=(0,A.useState)(null),[G,K]=(0,A.useState)(!1),[q,J]=(0,A.useState)(null),Y=(0,A.useRef)(new Set),X=(0,A.useMemo)(()=>t?[...Ee,...Oe]:[...Ee,De,...Oe],[t]),Z=s(t?`pm.requirements.cols.scoped.v1`:`pm.requirements.cols.v1`,X),Ge=ee(t?`pm.requirements.scroll.scoped`:`pm.requirements.scroll`),Ke=Z.widthOf(`id`)??88,qe=(0,A.useMemo)(()=>[{value:`all`,label:`全部项目`},...g.projects.map(e=>({value:e.id,label:e.name}))],[g.projects]),Je=(0,A.useMemo)(()=>[{value:`all`,label:`全部迭代`},...ie(g.iterations.filter(e=>F===`all`||e.projectId===F)).map(e=>({value:e.id,label:e.name}))],[g.iterations,F]),Ye=(0,A.useMemo)(()=>{let e=new Map(g.projects.map(e=>[e.id,e.name]));return t=>e.get(t)??`—`},[g.projects]),Xe=(0,A.useMemo)(()=>{let e=new Map(g.iterations.map(e=>[e.id,e.name]));return t=>t?e.get(t)??`—`:`—`},[g.iterations]),Q=(0,A.useMemo)(()=>ae(re(g.requirements,{projectId:F,iterationId:I,status:R,priority:z,keyword:B})),[g.requirements,F,I,R,z,B]),$=t?g.requirements.filter(e=>e.projectId===F).length:g.requirements.length,Ze=Math.max(1,Math.ceil(Q.length/H)),Qe=Math.min(Ue,Ze),$e=Q.slice((Qe-1)*H,Qe*H);(0,A.useEffect)(()=>{t||v===!0&&N!==`all`&&!g.projects.some(e=>e.id===N)&&P(`all`)},[v,g.projects,N,P,t]),(0,A.useEffect)(()=>{v===!0&&I!==`all`&&!g.iterations.some(e=>e.id===I&&(F===`all`||e.projectId===F))&&L(`all`)},[v,g.iterations,F,I,L]);let et=U?ie(g.iterations.filter(e=>e.projectId===U.projectId)):[];async function tt(){if(!U)return;if(!U.projectId){x(`请先选择所属项目`);return}let e=U.title.trim();if(!e)x(`需求描述不能为空`);else{K(!0);try{let t={projectId:U.projectId,iterationId:U.iterationId,title:e,priority:U.priority,status:U.status,description:U.description,acceptanceCriteria:U.acceptanceCriteria.filter(e=>e.text.trim()),githubIssue:U.githubIssue,attachment:U.attachment};U.id?await _(`requirements`,U.id,t):await ce(`requirements`,[t]);let n=!!U.id;W(null),Y.current.clear(),x(``),await E(!0),m(n?`已保存需求`:`已新建需求`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);x(t),m(`保存需求失败:${t}`,`error`)}finally{K(!1)}}}function nt(){let e=[...Y.current,...h(U?.attachment??``).map(e=>e.url)];Y.current.clear(),W(null),e.length&&le(e)}async function rt(e,t){K(!0);try{await _(`requirements`,e.id,{status:t}),await E(!0),m(`已更新需求状态为「${t}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);x(t),m(`更新状态失败:${t}`,`error`)}finally{K(!1)}}async function it(){let e=q;if(e){J(null),K(!0);try{await se(`requirements`,[e.id]),await E(!0),m(`已删除需求`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);x(t),m(`删除需求失败:${t}`,`error`)}finally{K(!1)}}}if(!r.ready)return(0,j.jsx)(ye,{label:`正在读取插件开关`});if(!r.on)return(0,j.jsx)(w,{children:n(`pmRequirements`)});if(v===null)return(0,j.jsx)(ye,{label:`正在连接项目管理服务`});if(!v)return(0,j.jsx)(w,{children:`需求管理需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`});if(g.projects.length===0&&!y&&!t)return(0,j.jsx)(w,{children:`还没有项目。请先在「项目列表」里新建一个项目,再回来维护需求。`});let at=[{value:`all`,label:`全部`},...M];return(0,j.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,j.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,j.jsxs)(`div`,{className:`text-xs text-stone-400`,children:[`共 `,(0,j.jsx)(`span`,{className:`font-medium text-stone-600`,children:$}),` 条需求`,Q.length===$?``:` · 筛选出 ${Q.length} 条`]}),(0,j.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[t?null:(0,j.jsx)(p,{flat:!0,showCheck:!1,ariaLabel:`按项目筛选需求`,className:`w-36`,options:qe,value:N,onChange:e=>{P(e),L(`all`),V(1)}}),(0,j.jsx)(p,{flat:!0,showCheck:!1,ariaLabel:`按迭代筛选需求`,className:`w-32`,options:Je,value:I,onChange:e=>{L(e),V(1)}}),(0,j.jsx)(p,{flat:!0,showCheck:!1,ariaLabel:`按优先级筛选需求`,className:`w-28`,options:[{value:`all`,label:`全部优先级`},...Re],value:z,onChange:e=>{Ve(e),V(1)}}),(0,j.jsxs)(`label`,{className:`relative block`,children:[(0,j.jsx)(D,{name:`search`,size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-stone-400`}),(0,j.jsx)(`input`,{value:B,onChange:e=>{He(e.target.value),V(1)},placeholder:`搜索编号 / 名称…`,className:`h-9 w-44 rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff]`})]}),(0,j.jsxs)(`button`,{type:`button`,disabled:G,onClick:()=>W(ze(F===`all`?``:F)),className:`inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white transition-colors hover:bg-[#2b5fd9] disabled:opacity-40`,children:[(0,j.jsx)(D,{name:`plus`,size:14}),`新建需求`]})]})]}),(0,j.jsx)(`div`,{className:`mt-3 flex shrink-0 flex-wrap items-center gap-2`,children:(0,j.jsx)(Se,{ariaLabel:`按状态筛选需求`,options:at,value:R,onChange:e=>{Be(e),V(1)}})}),b?(0,j.jsx)(ve,{message:b,onClose:()=>x(``)}):null,(0,j.jsxs)(`div`,{className:`mt-3 flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,j.jsx)(`div`,{ref:Ge,className:`tw-scroll-x min-h-0 flex-1 overflow-auto`,children:(0,j.jsxs)(`table`,{className:`tw-data-table tw-sticky-table w-full table-fixed text-sm`,style:Z.tableStyle,children:[(0,j.jsx)(`colgroup`,{children:X.map(e=>(0,j.jsx)(`col`,{style:Z.widthOf(e.key)?{width:Z.widthOf(e.key)}:void 0},e.key))}),(0,j.jsx)(`thead`,{className:`tw-table-head sticky top-0 z-10 text-xs text-stone-500`,children:(0,j.jsxs)(`tr`,{children:[(0,j.jsxs)(`th`,{className:`${ne} relative`,children:[`ID`,(0,j.jsx)(u,{...Z.resizeProps(`id`)})]}),(0,j.jsxs)(`th`,{className:te,style:{"--tw-sticky-left":`${Ke}px`},children:[`需求描述`,(0,j.jsx)(u,{...Z.resizeProps(`title`)})]}),(0,j.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`优先级`,(0,j.jsx)(u,{...Z.resizeProps(`priority`)})]}),(0,j.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`需求状态`,(0,j.jsx)(u,{...Z.resizeProps(`status`)})]}),t?null:(0,j.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`所属项目`,(0,j.jsx)(u,{...Z.resizeProps(`project`)})]}),(0,j.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`所属迭代`,(0,j.jsx)(u,{...Z.resizeProps(`iteration`)})]}),(0,j.jsx)(`th`,{"aria-hidden":`true`}),(0,j.jsx)(`th`,{className:a,children:`操作`})]})}),(0,j.jsxs)(`tbody`,{children:[y&&!g.requirements.length?(0,j.jsx)(`tr`,{children:(0,j.jsx)(`td`,{colSpan:X.length,className:`px-4 py-16 text-center`,children:(0,j.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):$e.length===0?(0,j.jsx)(`tr`,{children:(0,j.jsx)(`td`,{colSpan:X.length,children:$?(0,j.jsx)(xe,{children:`没有符合筛选条件的需求。`}):(0,j.jsx)(Ce,{icon:`file`,title:`暂无需求`,hint:`拆出第一条需求,再关联迭代、补充描述。`,action:(0,j.jsxs)(`button`,{type:`button`,onClick:()=>W(ze(F===`all`?``:F)),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-stone-200 px-3 text-xs text-stone-600 transition-colors hover:bg-stone-50`,children:[(0,j.jsx)(D,{name:`plus`,size:13}),`新建需求`]})})})}):null,$e.map(e=>(0,j.jsxs)(`tr`,{className:`border-t border-stone-100 hover:bg-[#f7f8fa]`,children:[(0,j.jsx)(`td`,{className:`${l} font-mono text-xs text-stone-400`,children:e.autoId}),(0,j.jsx)(`td`,{className:c,style:{"--tw-sticky-left":`${Ke}px`},children:(0,j.jsx)(fe,{text:e.title,onClick:()=>W({id:e.id,projectId:e.projectId,iterationId:e.iterationId,title:e.title,priority:e.priority,status:e.status,description:e.description,acceptanceCriteria:e.acceptanceCriteria.map(e=>({...e})),githubIssue:e.githubIssue,attachment:e.attachment})})}),(0,j.jsx)(`td`,{className:`px-2 py-1 align-middle`,children:(0,j.jsx)(he,{tone:we[e.priority],children:ue[e.priority]})}),(0,j.jsx)(`td`,{className:`min-w-0 overflow-hidden px-2 py-1 align-middle`,children:(0,j.jsx)(p,{unstyled:!0,hideChevron:!0,ariaLabel:`修改 ${e.title} 的状态`,disabled:G,options:M,value:e.status,onChange:t=>void rt(e,t),renderOptionPrefix:e=>(0,j.jsx)(O,{tone:C[e.value]}),renderTrigger:()=>(0,j.jsx)(he,{tone:C[e.status],children:oe[e.status]})})}),t?null:(0,j.jsx)(`td`,{className:`min-w-0 truncate px-2 py-1 align-middle text-sm text-stone-600`,children:(0,j.jsx)(`a`,{href:me(e.projectId),className:`block truncate transition-colors hover:text-[#3370ff]`,children:Ye(e.projectId)})}),(0,j.jsx)(`td`,{className:`min-w-0 truncate px-2 py-1 align-middle text-sm text-stone-500`,children:Xe(e.iterationId)}),(0,j.jsx)(`td`,{"aria-hidden":`true`}),(0,j.jsx)(`td`,{className:o,children:(0,j.jsx)(`button`,{type:`button`,"aria-label":`删除 ${e.title}`,disabled:G,onClick:()=>J(e),className:`tw-icon-danger inline-flex h-7 w-7 items-center justify-center rounded-md`,children:(0,j.jsx)(D,{name:`trash`,size:15})})})]},e.id))]})]})}),Q.length>0?(0,j.jsx)(f,{page:Qe,totalPages:Ze,pageSize:H,busy:G,onPage:V,onPageSize:e=>{We(e),V(1)}}):null]}),(0,j.jsx)(_e,{open:U!==null,title:U?.id?`编辑需求`:`新建需求`,busy:G,submitLabel:U?.id?`保存`:`创建`,onClose:()=>nt(),onSubmit:()=>void tt(),children:U?(0,j.jsxs)(`div`,{className:`space-y-1`,children:[t?null:(0,j.jsx)(T,{label:`所属项目`,required:!0,children:(0,j.jsx)(k,{ariaLabel:`所属项目`,options:g.projects.map(e=>({value:e.id,label:e.name})),value:U.projectId,onChange:e=>{let t=g.iterations.some(t=>t.id===U.iterationId&&t.projectId===e);W({...U,projectId:e,iterationId:t?U.iterationId:``})}})}),(0,j.jsx)(T,{label:`所属迭代`,children:(0,j.jsx)(k,{ariaLabel:`所属迭代`,options:[{value:``,label:`不关联迭代`},...et.map(e=>({value:e.id,label:e.name}))],value:U.iterationId,onChange:e=>W({...U,iterationId:e}),disabled:et.length===0})}),(0,j.jsx)(T,{label:`需求描述`,required:!0,children:(0,j.jsx)(`textarea`,{autoFocus:!0,value:U.title,onChange:e=>W({...U,title:e.target.value}),placeholder:`一句话写清要做什么`,rows:3,className:ge})}),(0,j.jsx)(T,{label:`优先级`,children:(0,j.jsx)(k,{ariaLabel:`优先级`,options:Re,value:U.priority,onChange:e=>W({...U,priority:e}),renderOptionPrefix:e=>(0,j.jsx)(O,{tone:we[e.value]})})}),(0,j.jsx)(T,{label:`需求状态`,children:(0,j.jsx)(k,{ariaLabel:`需求状态`,options:M,value:U.status,onChange:e=>W({...U,status:e}),renderOptionPrefix:e=>(0,j.jsx)(O,{tone:C[e.value]})})}),(0,j.jsx)(T,{label:`附件`,children:(0,j.jsx)(Te,{value:U.attachment,onChange:e=>W(t=>t&&{...t,attachment:e}),entity:`requirements`,recordId:U.id??``,seenUrls:Y,onError:x,onPersisted:()=>void E(!0)})}),(0,j.jsx)(T,{label:`备注`,children:(0,j.jsx)(`textarea`,{value:U.description,onChange:e=>W({...U,description:e.target.value}),placeholder:`补充背景、目标与范围(可选)`,rows:4,className:ge})})]}):null}),(0,j.jsx)(i,{open:q!==null,title:`删除需求`,message:`确定删除「${q?.title??``}」?关联的缺陷会保留,但不再关联到这条需求。`,confirmLabel:`删除`,danger:`solid`,onClose:()=>J(null),onConfirm:()=>void it()})]})}export{N as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{t as default}from"./PmRequirementsBoard.CXaGeFl9.js";
|
|
@@ -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}from"./plugins.CVM1IaoC.js";import{a,n as o,o as s,r as c}from"./view-prefs.D1snIG5o.js";import{t as l}from"./react-dom.DLW9pGCF.js";import{t as u}from"./jsx-runtime.DUg_B_vD.js";import{t as d}from"./OverflowHint.pvo2Xc8R.js";import{t as f}from"./SelectDropdown.apWlFGbA.js";import{t as p}from"./SlideOverDrawer.DMWJPD_W.js";import{_ as m,v as h,y as g}from"./pm.pMOkNqqK.js";var _=e(t(),1),v=e(l(),1),y=u(),b=8e3;function x(e,t,n){let[r,i]=(0,_.useState)(()=>o(e,t,n));return[r,(0,_.useCallback)(t=>{i(t),a(e,t)},[e])]}function S(e,t=``){let[n,r]=(0,_.useState)(()=>c(e)||t);return[n,(0,_.useCallback)(n=>{r(n),s(e,n===t?``:n)},[e,t])]}function C(e){let[t,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(()=>r(e));return(0,_.useEffect)(()=>{let t=!0,o=i(()=>s(r(e)));return n().then(()=>{t&&(s(r(e)),a(!0))}),()=>{t=!1,o()}},[e]),{ready:t,on:o}}var w=(0,_.createContext)(null);function T(e){let[t,n]=(0,_.useState)(m),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(!0),[s,c]=(0,_.useState)(``),l=(0,_.useRef)(!0),u=(0,_.useCallback)(async(e=!1)=>{e||o(!0);try{let e=await g();return l.current?(n(e),i(!0),c(``),e):null}catch(e){return l.current&&c(e instanceof Error?e.message:String(e)),null}finally{l.current&&!e&&o(!1)}},[]);return(0,_.useEffect)(()=>{if(!e){o(!1);return}l.current=!0;let t=null;return(async()=>{let e=await h();l.current&&(e?(await u(),l.current&&(i(!0),t=window.setInterval(()=>void u(!0),b))):(i(!1),o(!1)))})(),()=>{l.current=!1,t!==null&&window.clearInterval(t)}},[e,u]),{store:t,live:r,loading:a,error:s,setError:c,reload:u}}function E({children:e}){let t=T(!0);return(0,y.jsx)(w.Provider,{value:t,children:e})}function D(){let e=(0,_.useContext)(w),t=T(e===null);return e??t}var O={gray:`bg-stone-100 text-stone-600`,blue:`bg-[#e1eaff] text-[#1f4ec2]`,amber:`bg-[#fff1e3] text-[#a85b00]`,yellow:`bg-[#fff7d6] text-[#8a6100]`,red:`bg-[#fee4e3] text-[#c02a26]`,purple:`bg-[#efe7ff] text-[#5b32b4]`,green:`bg-[#d9f5d2] text-[#1d7a12]`,muted:`bg-stone-100 text-stone-400`},k={planning:`blue`,in_progress:`amber`,archived:`gray`},A={planning:`blue`,in_progress:`amber`,done:`green`},j={urgent:`red`,high:`amber`,medium:`yellow`,low:`gray`},M={pending:`gray`,todo:`blue`,in_progress:`blue`,testing:`purple`,done:`green`,cancelled:`muted`},ee={critical:`red`,major:`amber`,minor:`yellow`,trivial:`gray`},N={pending:`gray`,todo:`blue`,fixed:`amber`,verifying:`purple`,passed:`green`,cancelled:`muted`},P={gray:`#a8a29e`,blue:`#3370ff`,amber:`#f59e0b`,yellow:`#eab308`,red:`#ef4444`,purple:`#8b5cf6`,green:`#22c55e`,muted:`#d6d3d1`};function F({tone:e}){return(0,y.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full`,style:{backgroundColor:P[e]}})}function I({tone:e,children:t}){return(0,y.jsx)(`span`,{className:`inline-flex h-6 shrink-0 items-center rounded-md px-2 text-xs font-medium ${O[e]}`,children:t})}var L={plus:[`M12 5v14`,`M5 12h14`],more:[],chevronRight:[`m9 5 7 7-7 7`],chevronDown:[`m5 9 7 7 7-7`],arrowLeft:[`M19 12H5`,`m11 18-6-6 6-6`],pencil:[`M12 20h9`,`M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z`],trash:[`M3 6h18`,`M8 6V4h8v2`,`M19 6l-1 14H6L5 6`,`M10 11v6`,`M14 11v6`],copy:[`M9 9.5A1.5 1.5 0 0 1 10.5 8h7A1.5 1.5 0 0 1 19 9.5v7A1.5 1.5 0 0 1 17.5 18h-7A1.5 1.5 0 0 1 9 16.5Z`,`M5 15V5.5A1.5 1.5 0 0 1 6.5 4H15`],check:[`m4.5 12.5 5 5 10-11`],play:[`M8 5.5v13l11-6.5Z`],search:[`M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14Z`,`m20 20-3.6-3.6`],folder:[`M3 7.5A2.5 2.5 0 0 1 5.5 5h3.2l2 2h7.8A2.5 2.5 0 0 1 21 9.5v7A2.5 2.5 0 0 1 18.5 19h-13A2.5 2.5 0 0 1 3 16.5Z`],calendar:[`M4 7.5A2.5 2.5 0 0 1 6.5 5h11A2.5 2.5 0 0 1 20 7.5v11a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2Z`,`M8 3v4`,`M16 3v4`,`M4 10h16`],file:[`M7 3.5h6.5L18 8v12.5H7Z`,`M13.5 3.5V8H18`,`M10 12.5h5`,`M10 16h5`],bug:[`M8.5 9.5h7V14a3.5 3.5 0 0 1-7 0Z`,`M9.5 6.2 12 8l2.5-1.8`,`M4.5 13H8.5`,`M15.5 13h4`,`M6 18.5l2-2`,`M18 18.5l-2-2`]};function R({name:e,size:t=16,className:n=``}){return e===`more`?(0,y.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:t,height:t,fill:`currentColor`,"aria-hidden":`true`,className:n,children:[(0,y.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1.6`}),(0,y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.6`}),(0,y.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1.6`})]}):(0,y.jsx)(`svg`,{viewBox:`0 0 24 24`,width:t,height:t,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:n,children:L[e].map(e=>(0,y.jsx)(`path`,{d:e},e))})}function z({tabs:e,value:t,onChange:n,ariaLabel:r}){return(0,y.jsx)(`div`,{className:`tw-pm-tabs`,role:`tablist`,"aria-label":r,children:e.map(e=>(0,y.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t===e.value,onClick:()=>n(e.value),className:`tw-pm-tab`,children:[e.label,typeof e.count==`number`?(0,y.jsx)(`span`,{className:`tw-pm-tab-count`,children:e.count}):null]},e.value))})}function B({options:e,value:t,onChange:n,ariaLabel:r}){return(0,y.jsx)(`div`,{className:`tw-pm-pills`,role:`group`,"aria-label":r,children:e.map(e=>(0,y.jsx)(`button`,{type:`button`,"aria-pressed":t===e.value,onClick:()=>n(e.value),children:e.label},e.value))})}function V({icon:e,title:t,hint:n,action:r}){return(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center px-4 py-20 text-center`,children:[(0,y.jsx)(`span`,{className:`tw-pm-tile mb-4 flex h-16 w-16 items-center justify-center rounded-2xl`,children:(0,y.jsx)(R,{name:e,size:30})}),(0,y.jsx)(`p`,{className:`text-sm font-medium text-stone-600`,children:t}),(0,y.jsx)(`p`,{className:`mt-1 text-xs text-stone-400`,children:n}),r?(0,y.jsx)(`div`,{className:`mt-4`,children:r}):null]})}function H(e){return`/pm/projects/detail/?id=${encodeURIComponent(e)}`}var U=`h-9 w-full rounded-md border border-transparent bg-transparent px-2 text-sm text-stone-800 outline-none transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:bg-white placeholder:text-stone-400`,W=`min-h-[72px] w-full resize-y rounded-md border border-stone-200 bg-white px-2 py-1.5 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff] placeholder:text-stone-400`;function G(e){return(0,y.jsx)(f,{flat:!0,menuMatchTrigger:!0,ariaLabel:e.ariaLabel,options:e.options,value:e.value,onChange:e.onChange,disabled:e.disabled,renderOptionPrefix:e.renderOptionPrefix})}function K({page:e,totalPages:t,busy:n=!1,onPage:r}){let i=`h-7 shrink-0 rounded-md border border-stone-200 bg-white px-2.5 text-xs text-stone-600 transition-colors hover:bg-stone-50 disabled:cursor-not-allowed disabled:opacity-40`;return(0,y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-center gap-2 pt-3`,children:[(0,y.jsx)(`button`,{type:`button`,className:i,disabled:n||e<=1,onClick:()=>r(e-1),children:`上一页`}),(0,y.jsxs)(`span`,{className:`px-2 text-xs tabular-nums text-stone-400`,children:[e,` / `,t]}),(0,y.jsx)(`button`,{type:`button`,className:i,disabled:n||e>=t,onClick:()=>r(e+1),children:`下一页`})]})}function q({label:e}){return(0,y.jsx)(`div`,{className:`flex min-h-[240px] items-center justify-center rounded-xl border border-stone-200 bg-white`,"aria-busy":`true`,"aria-label":e,children:(0,y.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}function J({children:e}){return(0,y.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:e})}function Y({children:e}){return(0,y.jsx)(`div`,{className:`px-4 py-16 text-center text-sm text-stone-400`,children:e})}function X({open:e,title:t,busy:n,submitLabel:r,onClose:i,onSubmit:a,children:o}){return(0,y.jsx)(p,{open:e,onClose:i,title:t,footer:(0,y.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t border-stone-100 px-2 py-3`,children:[(0,y.jsx)(`button`,{type:`button`,onClick:i,className:`h-8 rounded-lg border border-stone-200 px-3 text-sm text-stone-600 hover:bg-stone-100`,children:`取消`}),(0,y.jsx)(`button`,{type:`button`,disabled:n,onClick:a,className:`h-8 rounded-lg bg-[#3370ff] px-3 text-sm font-medium text-white hover:bg-[#2b5fd9] disabled:opacity-40`,children:r})]}),children:o})}function Z({label:e,required:t,children:n}){return(0,y.jsxs)(`div`,{className:`flex items-start gap-3 px-2 py-2`,children:[(0,y.jsx)(`div`,{className:`flex h-9 w-[88px] shrink-0 items-center text-sm text-stone-600`,children:(0,y.jsxs)(`span`,{className:`truncate`,children:[e,t?(0,y.jsx)(`span`,{className:`ml-0.5 text-red-500`,children:`*`}):null]})}),(0,y.jsx)(`div`,{className:`min-w-0 flex-1 [&>div]:mt-0`,children:n})]})}function Q({file:e,onClose:t}){return e?(0,v.createPortal)((0,y.jsxs)(`div`,{className:`fixed inset-0 z-[70] flex items-center justify-center bg-stone-900/70 p-6 sm:p-10`,role:`dialog`,"aria-modal":`true`,"aria-label":e.name,onClick:t,children:[(0,y.jsx)(`img`,{src:e.url,alt:e.name,className:`max-h-full max-w-full rounded-lg bg-white object-contain shadow-2xl`,onClick:e=>e.stopPropagation()}),(0,y.jsx)(`button`,{type:`button`,"aria-label":`关闭预览`,onClick:t,className:`absolute right-4 top-4 flex h-9 w-9 items-center justify-center rounded-full bg-white/90 text-lg text-stone-600 shadow-md transition-colors hover:bg-white hover:text-stone-900`,children:`✕`})]}),document.body):null}function $({message:e,onClose:t}){return(0,y.jsxs)(`div`,{className:`mx-4 mt-3 flex shrink-0 items-start gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700`,children:[(0,y.jsx)(`span`,{className:`min-w-0 flex-1`,children:e}),(0,y.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`关闭`,className:`-mr-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded text-red-700/70 hover:bg-red-100 hover:text-red-900`,children:`✕`})]})}function te({text:e,onClick:t}){let n=(0,y.jsx)(d,{text:e,className:`block min-w-0 truncate text-sm text-stone-800 group-hover/pm-title:text-[#3370ff]`});return t?(0,y.jsx)(`button`,{type:`button`,onClick:t,className:`group/pm-title block min-w-0 max-w-full text-left`,children:n}):n}export{D as A,te as C,x as D,H as E,S as O,I as S,M as T,J as _,W as a,E as b,X as c,$ as d,Z as f,q as g,Q as h,U as i,C as k,Y as l,R as m,N as n,k as o,B as p,A as r,F as s,ee as t,V as u,K as v,j as w,z as x,G as y};
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.DAIyT--R.js";import{i as r,o as i}from"./plugins.Di6uuouN.js";import{n as a,o,r as s,s as c}from"./view-prefs.DkS1ldnh.js";import{t as l}from"./react-dom.DLW9pGCF.js";import{t as u}from"./jsx-runtime.DUg_B_vD.js";import{t as d}from"./OverflowHint.pvo2Xc8R.js";import{t as f}from"./SelectDropdown.apWlFGbA.js";import{t as p}from"./SlideOverDrawer.DMWJPD_W.js";import{_ as m,v as h,y as g}from"./pm.pMOkNqqK.js";var _=e(t(),1),v=e(l(),1),y=u(),b=8e3;function x(e,t,n){let[r,i]=(0,_.useState)(()=>a(e,t,n));return[r,(0,_.useCallback)(t=>{i(t),o(e,t)},[e])]}function S(e,t=``){let[n,r]=(0,_.useState)(()=>s(e)||t);return[n,(0,_.useCallback)(n=>{r(n),c(e,n===t?``:n)},[e,t])]}function C(e){let[t,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(()=>r(e));return(0,_.useEffect)(()=>{let t=!0,o=i(()=>s(r(e)));return n().then(()=>{t&&(s(r(e)),a(!0))}),()=>{t=!1,o()}},[e]),{ready:t,on:o}}var w=(0,_.createContext)(null);function T(e){let[t,n]=(0,_.useState)(m),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(!0),[s,c]=(0,_.useState)(``),l=(0,_.useRef)(!0),u=(0,_.useCallback)(async(e=!1)=>{e||o(!0);try{let e=await g();return l.current?(n(e),i(!0),c(``),e):null}catch(e){return l.current&&c(e instanceof Error?e.message:String(e)),null}finally{l.current&&!e&&o(!1)}},[]);return(0,_.useEffect)(()=>{if(!e){o(!1);return}l.current=!0;let t=null;return(async()=>{let e=await h();l.current&&(e?(await u(),l.current&&(i(!0),t=window.setInterval(()=>void u(!0),b))):(i(!1),o(!1)))})(),()=>{l.current=!1,t!==null&&window.clearInterval(t)}},[e,u]),{store:t,live:r,loading:a,error:s,setError:c,reload:u}}function E({children:e}){let t=T(!0);return(0,y.jsx)(w.Provider,{value:t,children:e})}function D(){let e=(0,_.useContext)(w),t=T(e===null);return e??t}var O={gray:`bg-stone-100 text-stone-600`,blue:`bg-[#e1eaff] text-[#1f4ec2]`,amber:`bg-[#fff1e3] text-[#a85b00]`,yellow:`bg-[#fff7d6] text-[#8a6100]`,red:`bg-[#fee4e3] text-[#c02a26]`,purple:`bg-[#efe7ff] text-[#5b32b4]`,green:`bg-[#d9f5d2] text-[#1d7a12]`,muted:`bg-stone-100 text-stone-400`},k={planning:`blue`,in_progress:`amber`,archived:`gray`},A={planning:`blue`,in_progress:`amber`,done:`green`},j={urgent:`red`,high:`amber`,medium:`yellow`,low:`gray`},M={pending:`gray`,todo:`blue`,in_progress:`blue`,testing:`purple`,done:`green`,cancelled:`muted`},ee={critical:`red`,major:`amber`,minor:`yellow`,trivial:`gray`},N={pending:`gray`,todo:`blue`,fixed:`amber`,verifying:`purple`,passed:`green`,cancelled:`muted`},P={gray:`#a8a29e`,blue:`#3370ff`,amber:`#f59e0b`,yellow:`#eab308`,red:`#ef4444`,purple:`#8b5cf6`,green:`#22c55e`,muted:`#d6d3d1`};function F({tone:e}){return(0,y.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full`,style:{backgroundColor:P[e]}})}function I({tone:e,children:t}){return(0,y.jsx)(`span`,{className:`inline-flex h-6 shrink-0 items-center rounded-md px-2 text-xs font-medium ${O[e]}`,children:t})}var L={plus:[`M12 5v14`,`M5 12h14`],more:[],chevronRight:[`m9 5 7 7-7 7`],chevronDown:[`m5 9 7 7 7-7`],arrowLeft:[`M19 12H5`,`m11 18-6-6 6-6`],pencil:[`M12 20h9`,`M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z`],trash:[`M3 6h18`,`M8 6V4h8v2`,`M19 6l-1 14H6L5 6`,`M10 11v6`,`M14 11v6`],copy:[`M9 9.5A1.5 1.5 0 0 1 10.5 8h7A1.5 1.5 0 0 1 19 9.5v7A1.5 1.5 0 0 1 17.5 18h-7A1.5 1.5 0 0 1 9 16.5Z`,`M5 15V5.5A1.5 1.5 0 0 1 6.5 4H15`],check:[`m4.5 12.5 5 5 10-11`],play:[`M8 5.5v13l11-6.5Z`],search:[`M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14Z`,`m20 20-3.6-3.6`],folder:[`M3 7.5A2.5 2.5 0 0 1 5.5 5h3.2l2 2h7.8A2.5 2.5 0 0 1 21 9.5v7A2.5 2.5 0 0 1 18.5 19h-13A2.5 2.5 0 0 1 3 16.5Z`],calendar:[`M4 7.5A2.5 2.5 0 0 1 6.5 5h11A2.5 2.5 0 0 1 20 7.5v11a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2Z`,`M8 3v4`,`M16 3v4`,`M4 10h16`],file:[`M7 3.5h6.5L18 8v12.5H7Z`,`M13.5 3.5V8H18`,`M10 12.5h5`,`M10 16h5`],bug:[`M8.5 9.5h7V14a3.5 3.5 0 0 1-7 0Z`,`M9.5 6.2 12 8l2.5-1.8`,`M4.5 13H8.5`,`M15.5 13h4`,`M6 18.5l2-2`,`M18 18.5l-2-2`]};function R({name:e,size:t=16,className:n=``}){return e===`more`?(0,y.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:t,height:t,fill:`currentColor`,"aria-hidden":`true`,className:n,children:[(0,y.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1.6`}),(0,y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.6`}),(0,y.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1.6`})]}):(0,y.jsx)(`svg`,{viewBox:`0 0 24 24`,width:t,height:t,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:n,children:L[e].map(e=>(0,y.jsx)(`path`,{d:e},e))})}function z({tabs:e,value:t,onChange:n,ariaLabel:r}){return(0,y.jsx)(`div`,{className:`tw-pm-tabs`,role:`tablist`,"aria-label":r,children:e.map(e=>(0,y.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t===e.value,onClick:()=>n(e.value),className:`tw-pm-tab`,children:[e.label,typeof e.count==`number`?(0,y.jsx)(`span`,{className:`tw-pm-tab-count`,children:e.count}):null]},e.value))})}function B({options:e,value:t,onChange:n,ariaLabel:r}){return(0,y.jsx)(`div`,{className:`tw-pm-pills`,role:`group`,"aria-label":r,children:e.map(e=>(0,y.jsx)(`button`,{type:`button`,"aria-pressed":t===e.value,onClick:()=>n(e.value),children:e.label},e.value))})}function V({icon:e,title:t,hint:n,action:r}){return(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center px-4 py-20 text-center`,children:[(0,y.jsx)(`span`,{className:`tw-pm-tile mb-4 flex h-16 w-16 items-center justify-center rounded-2xl`,children:(0,y.jsx)(R,{name:e,size:30})}),(0,y.jsx)(`p`,{className:`text-sm font-medium text-stone-600`,children:t}),(0,y.jsx)(`p`,{className:`mt-1 text-xs text-stone-400`,children:n}),r?(0,y.jsx)(`div`,{className:`mt-4`,children:r}):null]})}function H(e){return`/pm/projects/detail/?id=${encodeURIComponent(e)}`}var U=`h-9 w-full rounded-md border border-transparent bg-transparent px-2 text-sm text-stone-800 outline-none transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:bg-white placeholder:text-stone-400`,W=`min-h-[72px] w-full resize-y rounded-md border border-stone-200 bg-white px-2 py-1.5 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff] placeholder:text-stone-400`;function G(e){return(0,y.jsx)(f,{flat:!0,menuMatchTrigger:!0,ariaLabel:e.ariaLabel,options:e.options,value:e.value,onChange:e.onChange,disabled:e.disabled,renderOptionPrefix:e.renderOptionPrefix})}function K({page:e,totalPages:t,busy:n=!1,onPage:r}){let i=`h-7 shrink-0 rounded-md border border-stone-200 bg-white px-2.5 text-xs text-stone-600 transition-colors hover:bg-stone-50 disabled:cursor-not-allowed disabled:opacity-40`;return(0,y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-center gap-2 pt-3`,children:[(0,y.jsx)(`button`,{type:`button`,className:i,disabled:n||e<=1,onClick:()=>r(e-1),children:`上一页`}),(0,y.jsxs)(`span`,{className:`px-2 text-xs tabular-nums text-stone-400`,children:[e,` / `,t]}),(0,y.jsx)(`button`,{type:`button`,className:i,disabled:n||e>=t,onClick:()=>r(e+1),children:`下一页`})]})}function q({label:e}){return(0,y.jsx)(`div`,{className:`flex min-h-[240px] items-center justify-center rounded-xl border border-stone-200 bg-white`,"aria-busy":`true`,"aria-label":e,children:(0,y.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}function J({children:e}){return(0,y.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:e})}function Y({children:e}){return(0,y.jsx)(`div`,{className:`px-4 py-16 text-center text-sm text-stone-400`,children:e})}function X({open:e,title:t,busy:n,submitLabel:r,onClose:i,onSubmit:a,children:o}){return(0,y.jsx)(p,{open:e,onClose:i,title:t,footer:(0,y.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t border-stone-100 px-2 py-3`,children:[(0,y.jsx)(`button`,{type:`button`,onClick:i,className:`h-8 rounded-lg border border-stone-200 px-3 text-sm text-stone-600 hover:bg-stone-100`,children:`取消`}),(0,y.jsx)(`button`,{type:`button`,disabled:n,onClick:a,className:`h-8 rounded-lg bg-[#3370ff] px-3 text-sm font-medium text-white hover:bg-[#2b5fd9] disabled:opacity-40`,children:r})]}),children:o})}function Z({label:e,required:t,children:n}){return(0,y.jsxs)(`div`,{className:`flex items-start gap-3 px-2 py-2`,children:[(0,y.jsx)(`div`,{className:`flex h-9 w-[88px] shrink-0 items-center text-sm text-stone-600`,children:(0,y.jsxs)(`span`,{className:`truncate`,children:[e,t?(0,y.jsx)(`span`,{className:`ml-0.5 text-red-500`,children:`*`}):null]})}),(0,y.jsx)(`div`,{className:`min-w-0 flex-1 [&>div]:mt-0`,children:n})]})}function Q({file:e,onClose:t}){return e?(0,v.createPortal)((0,y.jsxs)(`div`,{className:`fixed inset-0 z-[70] flex items-center justify-center bg-stone-900/70 p-6 sm:p-10`,role:`dialog`,"aria-modal":`true`,"aria-label":e.name,onClick:t,children:[(0,y.jsx)(`img`,{src:e.url,alt:e.name,className:`max-h-full max-w-full rounded-lg bg-white object-contain shadow-2xl`,onClick:e=>e.stopPropagation()}),(0,y.jsx)(`button`,{type:`button`,"aria-label":`关闭预览`,onClick:t,className:`absolute right-4 top-4 flex h-9 w-9 items-center justify-center rounded-full bg-white/90 text-lg text-stone-600 shadow-md transition-colors hover:bg-white hover:text-stone-900`,children:`✕`})]}),document.body):null}function $({message:e,onClose:t}){return(0,y.jsxs)(`div`,{className:`mx-4 mt-3 flex shrink-0 items-start gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700`,children:[(0,y.jsx)(`span`,{className:`min-w-0 flex-1`,children:e}),(0,y.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`关闭`,className:`-mr-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded text-red-700/70 hover:bg-red-100 hover:text-red-900`,children:`✕`})]})}function te({text:e,onClick:t}){let n=(0,y.jsx)(d,{text:e,className:`block min-w-0 truncate text-sm text-stone-800 group-hover/pm-title:text-[#3370ff]`});return t?(0,y.jsx)(`button`,{type:`button`,onClick:t,className:`group/pm-title block min-w-0 max-w-full text-left`,children:n}):n}export{D as A,te as C,x as D,H as E,S as O,I as S,M as T,J as _,W as a,E as b,X as c,$ as d,Z as f,q as g,Q as h,U as i,C as k,Y as l,R as m,N as n,k as o,B as p,A as r,F as s,ee as t,V as u,K as v,j as w,z as x,G as y};
|
|
@@ -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.DAIyT--R.js";import{a as i,i as a,n as o,o as ee,s as te}from"./plugins.Di6uuouN.js";import{t as s}from"./jsx-runtime.DUg_B_vD.js";import{t as ne}from"./ConfirmDialog.D5qXeML0.js";import{showToast as c}from"./Toast.BO2NFckG.js";import{i as re}from"./case-types.B6MLX3iE.js";import{$ as ie,a as ae}from"./req-analysis.CIZ_cIJQ.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.Diq5zuSt.js";import{d as _e,t as ve}from"./open-docs-in-session.D608wzlx.js";import{N as ye,P as be,i as xe,r as Se}from"./case-review.D1E3ldss.js";import{r as Ce}from"./report-prompt.CAfZ6RIo.js";import{g as we,s as Te}from"./ui-auto.BmC9JJ_X.js";import{f as Ee,s as De,t as Oe,y as ke}from"./story-review.BRcUdixS.js";import{t as y}from"./NamePromptDialog.5XFIvdqv.js";import{m as b}from"./PmShared.Bzn6AGsN.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,ie(!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,be(!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,ye(!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 _e().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(ae)]=`reqAnalysis`),P.storyReview&&(i[p(Oe)]=`storyReview`),P.testPoints&&(i[p(Ee)]=`testPoints`),P.caseReview&&(i[p(xe)]=`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 ve(`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 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,p as r}from"./app-config.
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,p as r}from"./app-config.DAIyT--R.js";import{i,o as a,s as o}from"./plugins.Di6uuouN.js";import{t as s}from"./jsx-runtime.DUg_B_vD.js";import{n as c,t as l}from"./DocsPager.WMztSW4O.js";import{t as u}from"./SelectDropdown.apWlFGbA.js";import{showToast as d}from"./Toast.BO2NFckG.js";import{a as ee,c as te,i as ne,o as re,s as f,t as p}from"./report-prompt.CAfZ6RIo.js";var m=e(t(),1),h=`tw.reports.kind.v1`,g=Object.keys(p);function _(e){return typeof e==`string`&&g.includes(e)}function v(e=`day`){try{let t=localStorage.getItem(r(h));return _(t)?t:e}catch{return e}}function y(e){if(_(e))try{localStorage.setItem(r(h),e)}catch{}}var b=s(),x=[`day`,`week`,`month`],S=20,C=`tw.reports.page-size.v1`;function w(e){return e.replace(/\.(md|markdown|txt)$/i,``)}function T(e){return e.replace(/\.(md|markdown|txt|html?)$/i,``)}function E(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return`—`;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}/${n(t.getMonth()+1)}/${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function ie(e){return!Number.isFinite(e)||e<=0?`—`:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}var ae={day:`日`,week:`周`,month:`月`};function D(){let[e,t]=(0,m.useState)(!1),[r,s]=(0,m.useState)(!0),[h,g]=(0,m.useState)(()=>v()),_=(0,m.useRef)(h),[D,O]=(0,m.useState)([]),[k,A]=(0,m.useState)(``),[j,M]=(0,m.useState)(!1),[N,P]=(0,m.useState)(null),[F,I]=(0,m.useState)(``),[L,R]=(0,m.useState)([]),[z,B]=(0,m.useState)(``),[V,H]=(0,m.useState)(!1),[U,W]=(0,m.useState)(1),[G,K]=c(S,C),q=(0,m.useCallback)(async(e,t)=>{M(!0),P(null);try{if(t?.ensure)try{await te(!0)}catch{}let n=await ee(e);O(n.items),A(n.dir)}catch(e){let t=e instanceof Error?e.message:String(e);P(t.includes(`404`)?`工作汇报需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`:t),O([])}finally{M(!1)}},[]);(0,m.useEffect)(()=>{let e=a(e=>s(!!e.reports));return n().then(()=>{s(i(`reports`)),t(!0)}),e},[]);let J=(0,m.useCallback)(async()=>{try{let e=await ne();R(e.items),B(e.promptFile),e.promptFile||d(`没有读到「提示词管理」里的工作汇报提示词,写汇报前请先在提示词管理里补一份。`,`error`)}catch(e){let t=e instanceof Error?e.message:String(e);d(`读取工作汇报提示词失败:${t}`,`error`)}},[]);(0,m.useEffect)(()=>{e&&r&&(async()=>{await q(_.current,{ensure:!0}),await J()})()},[e,r,q,J]);function oe(e){y(e),e!==h&&(g(e),W(1),O([]),q(e))}async function se(e){if(e&&e!==z){H(!0),P(null);try{let t=await f(e);B(t),R(e=>e.map(e=>({...e,selected:e.name===t})))}catch(e){let t=e instanceof Error?e.message:String(e);P(t),d(`切换提示词失败:${t}`,`error`)}finally{H(!1)}}}let ce=(0,m.useMemo)(()=>L.length?L.map(e=>({value:e.name,label:w(e.name)})):[{value:``,label:`暂无提示词`}],[L]),Y=(0,m.useMemo)(()=>[...D].sort((e,t)=>t.generatedAt-e.generatedAt),[D]),X=Math.max(1,Math.ceil(Y.length/G)),Z=Math.min(U,X),le=(0,m.useMemo)(()=>Y.slice((Z-1)*G,Z*G),[Y,Z,G]),ue=`/workbench/?report=${h}`;async function Q(e){if(!F){I(e.name),P(null);try{await re(e.kind,e.name)}catch(e){P(e instanceof Error?e.message:String(e))}finally{I(``)}}}if(!e)return(0,b.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex items-center justify-center min-h-[220px]`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,b.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})});if(!r)return(0,b.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:o(`reports`)});let $=Y[0];return(0,b.jsxs)(`section`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,b.jsxs)(`div`,{className:`shrink-0 border-b border-stone-100 px-4 py-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg bg-stone-100/80 p-0.5`,children:x.map(e=>(0,b.jsx)(`button`,{type:`button`,onClick:()=>oe(e),className:`h-8 rounded-md px-3 text-sm transition-colors ${h===e?`bg-white font-medium text-stone-900 shadow-sm`:`text-stone-600 hover:text-stone-900`}`,children:p[e]},e))}),(0,b.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,b.jsx)(u,{className:`w-[172px]`,flat:!0,options:ce,value:z,onChange:e=>void se(e),disabled:!L.length||V,ariaLabel:`选择工作汇报提示词`,menuMinWidth:200}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>void(async()=>{await q(h),await J()})(),disabled:j,"aria-label":`刷新`,className:`flex h-9 w-9 items-center justify-center rounded-lg border border-stone-200 text-stone-500 transition-colors hover:bg-stone-50 hover:text-stone-800 disabled:opacity-40`,children:(0,b.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,b.jsx)(`path`,{d:`M21 12a9 9 0 1 1-3-6.7`}),(0,b.jsx)(`path`,{d:`M21 4v5h-5`})]})}),(0,b.jsx)(`a`,{href:ue,className:`inline-flex h-9 items-center whitespace-nowrap rounded-lg bg-[#3370ff] px-3 text-sm font-medium text-white transition-colors hover:bg-[#2b5fd9]`,children:`去工作台写汇报`})]})]}),(0,b.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-stone-400`,children:[(0,b.jsxs)(`span`,{children:[p[h],` · 共 `,D.length,` 篇`]}),$?(0,b.jsxs)(`span`,{className:`tabular-nums`,children:[`最近生成 `,E($.generatedAt)]}):null,(0,b.jsx)(`span`,{className:`min-w-0 truncate`,children:k||`—`}),(0,b.jsx)(`span`,{className:`ml-auto hidden shrink-0 sm:inline`,children:`点击卡片用系统默认程序打开`})]})]}),N?(0,b.jsxs)(`div`,{className:`mx-4 mt-3 flex shrink-0 items-start gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700`,children:[(0,b.jsx)(`span`,{className:`min-w-0 flex-1`,children:N}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>P(null),"aria-label":`关闭`,className:`-mr-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded text-red-700/70 hover:bg-red-100 hover:text-red-900`,children:`✕`})]}):null,(0,b.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto bg-stone-50/60 p-3 sm:p-4`,children:j&&D.length===0?(0,b.jsx)(`div`,{className:`flex min-h-[180px] items-center justify-center`,"aria-busy":`true`,children:(0,b.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})}):D.length===0?(0,b.jsxs)(`div`,{className:`flex min-h-[260px] flex-col items-center justify-center gap-2 rounded-xl border border-dashed border-stone-300 px-6 py-10 text-center`,children:[(0,b.jsx)(`span`,{className:`flex h-12 w-12 items-center justify-center rounded-xl bg-stone-100 text-stone-400`,children:(0,b.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`22`,height:`22`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,b.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),(0,b.jsx)(`path`,{d:`M14 3v5h5`}),(0,b.jsx)(`path`,{d:`M9 13h6M9 17h4`})]})}),(0,b.jsxs)(`div`,{className:`text-sm font-medium text-stone-700`,children:[`还没有`,p[h]]}),(0,b.jsxs)(`p`,{className:`max-w-md text-xs leading-5 text-stone-400`,children:[`保存到 `,k||`工作汇报/${p[h]}`,` 后会自动出现在这里。`]})]}):(0,b.jsx)(`ul`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,380px),1fr))] gap-2.5`,children:le.map(e=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`button`,{type:`button`,onClick:()=>void Q(e),disabled:!!F,className:`group flex w-full items-center gap-3 rounded-xl border border-stone-200 bg-white px-3.5 py-3 text-left transition-colors hover:border-[#3370ff]/50 hover:bg-stone-50 disabled:cursor-progress disabled:opacity-60`,children:[(0,b.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-stone-100 text-[13px] font-semibold text-stone-600`,children:ae[e.kind]}),(0,b.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`span`,{className:`block truncate text-sm font-medium text-stone-800 transition-colors group-hover:text-[#3370ff]`,children:T(e.name)}),(0,b.jsxs)(`span`,{className:`mt-0.5 block truncate text-xs text-stone-400 tabular-nums`,children:[E(e.generatedAt),` · `,ie(e.size)]})]}),(0,b.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 text-xs text-stone-400 transition-colors group-hover:text-[#3370ff]`,children:[F===e.name?`打开中…`:`打开`,(0,b.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,b.jsx)(`path`,{d:`m9 6 6 6-6 6`})})]})]})},e.name))})}),D.length>0?(0,b.jsx)(l,{page:Z,totalPages:X,pageSize:G,busy:j,onPage:W,onPageSize:e=>{K(e),W(1)}}):(0,b.jsx)(`div`,{className:`pb-2.5`})]})}export{D as default};
|