lantern-harness 0.1.21 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/builtin/session/session-runs.mjs +34 -1
  3. package/dist/500.html +4 -4
  4. package/dist/_astro/Base.GThhapKd.css +1 -0
  5. package/dist/_astro/Base.astro_astro_type_script_index_0_lang.CWRCetQl.js +2 -0
  6. package/dist/_astro/{CaseExecBoard.CwH1rd8R.js → CaseExecBoard.Dnb8oP5i.js} +1 -1
  7. package/dist/_astro/CaseGenerateApp.ci_JowEk.js +10 -0
  8. package/dist/_astro/CasesLibrary.CDjuLV_E.js +21 -0
  9. package/dist/_astro/ChatApp.Td2xCiQG.js +216 -0
  10. package/dist/_astro/{DashboardBoard.BDURPamv.js → DashboardBoard.D-zHXRds.js} +2 -2
  11. package/dist/_astro/DocsFileBrowser.BM3nH4VD.js +1 -0
  12. package/dist/_astro/{DocsPager.v4kQH163.js → DocsPager.B9VhI6E3.js} +1 -1
  13. package/dist/_astro/{DrawerField.C0ehOlDt.js → DrawerField.C0MkN-LW.js} +1 -1
  14. package/dist/_astro/{KnowledgeLibrary.B_99kzox.js → KnowledgeLibrary.D9KnqXzr.js} +1 -1
  15. package/dist/_astro/{PluginsPage.aQKIWMKz.js → PluginsPage.DBRfSxtq.js} +2 -2
  16. package/dist/_astro/PluginsPage.DMDyUktn.js +1 -0
  17. package/dist/_astro/PmBugsBoard.BnnaNP1y.js +1 -0
  18. package/dist/_astro/PmIterationsBoard.phiyhQVA.js +1 -0
  19. package/dist/_astro/{PmProjectDetail.BYVt43oh.js → PmProjectDetail.C8kRX5lu.js} +1 -1
  20. package/dist/_astro/{PmProjectsBoard.D06_aCFK.js → PmProjectsBoard.CFApEGPo.js} +1 -1
  21. package/dist/_astro/PmRequirementsBoard.B-AI9iZX.js +1 -0
  22. package/dist/_astro/PmRequirementsBoard.DR9egcgA.js +1 -0
  23. package/dist/_astro/PmShared.BrBicDMN.js +1 -0
  24. package/dist/_astro/PromptMountDialog.CpTT6L0a.js +62 -0
  25. package/dist/_astro/PromptsLibrary.sz6MivVn.js +1 -0
  26. package/dist/_astro/{ReportsPage.DOW1fswe.js → ReportsPage.CYZtpeiv.js} +1 -1
  27. package/dist/_astro/ReqAnalysisBoard.CazI9SU-.js +29 -0
  28. package/dist/_astro/RequirementsLibrary.R4dNZa9y.js +1 -0
  29. package/dist/_astro/SearchableSelect.Cbb8jMnP.js +1 -0
  30. package/dist/_astro/SelectDropdown.apWlFGbA.js +1 -0
  31. package/dist/_astro/{SettingsDialog.BBYaIU0N.js → SettingsDialog.Bs1I8b27.js} +1 -1
  32. package/dist/_astro/{SpaceSwitcher.DyzMNGfy.js → SpaceSwitcher.Dw9LjKiJ.js} +1 -1
  33. package/dist/_astro/{TagSelect.CuN5RdF4.js → TagSelect.B9W63KWq.js} +1 -1
  34. package/dist/_astro/{TasksBoard.BODqpiYV.js → TasksBoard.D0HwS5hd.js} +1 -1
  35. package/dist/_astro/{TemplatesLibrary.DDJLVEZk.js → TemplatesLibrary.CVv5Ef30.js} +1 -1
  36. package/dist/_astro/{TestStatsBoard.diX5s3sH.js → TestStatsBoard._qNcNorG.js} +1 -1
  37. package/dist/_astro/TodosBoard.CF5wbJy7.js +1 -0
  38. package/dist/_astro/UiAutoBoard.B-7mL3ez.js +9 -0
  39. package/dist/_astro/app-version.yT2l6J8H.js +1 -0
  40. package/dist/_astro/case-fields.h0roo2br.js +1 -0
  41. package/dist/_astro/case-gen-run.D8DGX0mr.js +19 -0
  42. package/dist/_astro/{case-review._K-6xl4v.js → case-review.C1hQRbQ2.js} +3 -3
  43. package/dist/_astro/case-template.F1Nv08GV.js +5 -0
  44. package/dist/_astro/docs-format.BlGh-XA_.js +1 -0
  45. package/dist/_astro/{llm.BZEzE0x2.js → llm.BuR7z55C.js} +1 -1
  46. package/dist/_astro/pm.pMOkNqqK.js +4 -0
  47. package/dist/_astro/req-analysis.dhgy4p2f.js +14 -0
  48. package/dist/_astro/{story-review.DvCTzGfr.js → story-review.BbdIf5zg.js} +5 -5
  49. package/dist/case-exec/index.html +5 -5
  50. package/dist/cases/generate/index.html +5 -5
  51. package/dist/cases/library/index.html +5 -5
  52. package/dist/dashboard/index.html +5 -5
  53. package/dist/docs/changelog/index.html +41 -5
  54. package/dist/docs/install/index.html +4 -4
  55. package/dist/docs/manual/index.html +17 -16
  56. package/dist/index.html +2 -2
  57. package/dist/knowledge/index.html +5 -5
  58. package/dist/plugins/index.html +5 -5
  59. package/dist/pm/bugs/index.html +5 -5
  60. package/dist/pm/iterations/index.html +5 -5
  61. package/dist/pm/projects/detail/index.html +5 -5
  62. package/dist/pm/projects/index.html +5 -5
  63. package/dist/pm/requirements/index.html +5 -5
  64. package/dist/prompts/index.html +5 -5
  65. package/dist/reports/index.html +5 -5
  66. package/dist/requirement-analysis/index.html +5 -5
  67. package/dist/requirements/index.html +5 -5
  68. package/dist/tasks/index.html +5 -5
  69. package/dist/templates/index.html +5 -5
  70. package/dist/test-automation/index.html +5 -5
  71. package/dist/test-stats/index.html +5 -5
  72. package/dist/todos/index.html +5 -5
  73. package/dist/workbench/index.html +5 -5
  74. package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +13 -12
  75. package/lh-plugins/case-backup-ttl.mjs +34 -0
  76. package/lh-plugins/lh-case-review.mjs +74 -2
  77. package/lh-plugins/lh-reports.mjs +6 -5
  78. package/lh-plugins/lh-req-analysis.mjs +41 -5
  79. package/package.json +1 -1
  80. package/dist/_astro/Base.NUwtco4a.css +0 -1
  81. package/dist/_astro/Base.astro_astro_type_script_index_0_lang.2J3Qrd4B.js +0 -1
  82. package/dist/_astro/CaseGenerateApp.CpL1po9n.js +0 -9
  83. package/dist/_astro/CasesLibrary.DAZMRzzt.js +0 -19
  84. package/dist/_astro/ChatApp.iDy6-iVA.js +0 -212
  85. package/dist/_astro/DocsFileBrowser.-dkkxR4X.js +0 -1
  86. package/dist/_astro/PluginsPage.B349vNQ7.js +0 -1
  87. package/dist/_astro/PmBugsBoard.Catlw5fm.js +0 -1
  88. package/dist/_astro/PmIterationsBoard.D4Bg969F.js +0 -1
  89. package/dist/_astro/PmRequirementsBoard.CyW9CfFH.js +0 -1
  90. package/dist/_astro/PmRequirementsBoard.DuXUq0HB.js +0 -1
  91. package/dist/_astro/PmShared.CwcLNMW2.js +0 -1
  92. package/dist/_astro/PromptMountDialog.YH2odDZx.js +0 -58
  93. package/dist/_astro/PromptsLibrary.dMO4dOAT.js +0 -1
  94. package/dist/_astro/ReqAnalysisBoard.DQpPjNNr.js +0 -29
  95. package/dist/_astro/RequirementsLibrary.Dd2DRKxL.js +0 -1
  96. package/dist/_astro/SearchableSelect.DZb-mxqw.js +0 -1
  97. package/dist/_astro/SelectDropdown.Cb-QtC-D.js +0 -1
  98. package/dist/_astro/TodosBoard.DQBEeiWU.js +0 -1
  99. package/dist/_astro/UiAutoBoard.3Xs5RjDq.js +0 -9
  100. package/dist/_astro/app-version.BqfBCSsN.js +0 -1
  101. package/dist/_astro/case-fields.CtFiDM_d.js +0 -1
  102. package/dist/_astro/case-gen-run.BI_ld4oo.js +0 -16
  103. package/dist/_astro/case-template.BGCVpSKI.js +0 -5
  104. package/dist/_astro/index.astro_astro_type_script_index_0_lang.DMnFoepS.js +0 -1
  105. package/dist/_astro/pm.CagBA-ht.js +0 -4
  106. package/dist/_astro/req-analysis.Dkbi-5A_.js +0 -9
@@ -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={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},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&&lt(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,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}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};
@@ -0,0 +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.BM3nH4VD.js";import{t as _e,u as ve}from"./open-docs-in-session.Cj0J2-XT.js";import{M as ye,i as be,j as xe,r as Se}from"./case-review.C1hQRbQ2.js";import{r as Ce}from"./report-prompt.CAfZ6RIo.js";import{g as we,s as Te}from"./ui-auto.BmC9JJ_X.js";import{d as Ee,o as De,t as Oe,v as ke}from"./story-review.BbdIf5zg.js";import{t as y}from"./NamePromptDialog.CS1pTTVl.js";import{m as b}from"./PmShared.BrBicDMN.js";var x=e(t(),1),S=`tw.prompts.mounted.v1`;function Ae(){try{let e=sessionStorage.getItem(r(S));if(!e)return{};let t=JSON.parse(e);if(!t||typeof t!=`object`)return{};let n={};for(let[e,r]of Object.entries(t))typeof e==`string`&&typeof r==`string`&&(n[e]=r);return n}catch{return{}}}function je(e){try{sessionStorage.setItem(r(S),JSON.stringify(e))}catch{}}var C=s(),Me=10;async function w(e=`.`){let{entries:t}=await l(`prompts`,e),n=[];for(let e of t)e.type===`file`?n.push(e):n.push(...await w(e.path));return n}function Ne({path:e,enabled:t,mounted:n}){let r=v(e,n);if(!r)return(0,C.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:`未关联`});if(r===`system`)return(0,C.jsx)(`span`,{className:`text-[11px] text-stone-600`,children:`系统默认`});let i=o(r)?.name??r,a=t[r]===!0,ee=g(e,n);return(0,C.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,C.jsx)(`span`,{className:`truncate text-[11px] text-stone-600`,children:i}),ee&&a?(0,C.jsx)(`span`,{className:`shrink-0 rounded bg-(--tw-accent-soft) px-1 text-[10px] text-(--tw-accent)`,children:`引用中`}):null]})}function T(){let e=he(`prompts`),[t,r]=(0,x.useState)(!1),[s,l]=(0,x.useState)(!0),[g,S]=(0,x.useState)(e?!0:null),[T,Pe]=(0,x.useState)(()=>e??[]),[E,D]=(0,x.useState)(null),[O,k]=(0,x.useState)(!1),[A,j]=(0,x.useState)({}),[M,N]=(0,x.useState)(null),[P,F]=(0,x.useState)(()=>i()),[I,Fe]=(0,x.useState)(()=>Ae()),[L,R]=(0,x.useState)(null),[z,B]=(0,x.useState)(null),[V,H]=(0,x.useState)(``),U=me(T,Me,`prompts`),W=(0,x.useRef)(!1),G=(0,x.useRef)(!1),K=(0,x.useRef)(!1),q=(0,x.useRef)(!1),J=(0,x.useRef)(!1),Y=(0,x.useCallback)(async()=>{D(null);try{let e=await w(`.`);Pe(e),pe(`prompts`,e)}catch(e){D(e instanceof Error?e.message:String(e))}},[]);(0,x.useEffect)(()=>{g&&P.reqAnalysis===!0&&!W.current&&(T.some(e=>e.name===`需求分析提示词.md`)||(W.current=!0,ae(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.reqAnalysis,T,Y]),(0,x.useEffect)(()=>{g&&P.storyReview===!0&&!G.current&&(T.some(e=>e.name===`用户故事审查提示词.md`)||(G.current=!0,De(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.storyReview,T,Y]),(0,x.useEffect)(()=>{g&&P.testPoints===!0&&!K.current&&(T.some(e=>e.name===`测试点生成提示词.md`)||(K.current=!0,ke(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.testPoints,T,Y]),(0,x.useEffect)(()=>{g&&P.caseReview===!0&&!q.current&&(T.some(e=>e.name===`用例质量评审提示词.md`)||(q.current=!0,ye(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.caseReview,T,Y]),(0,x.useEffect)(()=>{g&&P.caseBlindspot===!0&&!J.current&&(T.some(e=>e.name===`场景遗漏补全提示词.md`)||(J.current=!0,xe(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.caseBlindspot,T,Y]),(0,x.useEffect)(()=>{let e=ee(e=>{l(!!e.prompts),F(e)});return n().then(()=>{l(a(`prompts`)),F(i()),r(!0)}),e},[]),(0,x.useEffect)(()=>{t&&s&&(async()=>{await ce(`prompts`)?(await ve().catch(()=>null),await Y(),S(!0)):S(!1)})()},[t,s,Y]);let X=(0,x.useCallback)(async()=>{let e=await Te(),t=a(`reports`),n=t?await Ce().catch(()=>null):null;Fe(r=>{let i={};if(e)for(let t of e)i[p(t)]=`uiAuto`;else for(let[e,t]of Object.entries(r))t===`uiAuto`&&(i[e]=t);if(t){if(n?.promptFile)i[p(n.promptFile)]=`reports`;else for(let[e,t]of Object.entries(r))t===`reports`&&(i[e]=t)}if(P.reqAnalysis&&(i[p(ie)]=`reqAnalysis`),P.storyReview&&(i[p(Oe)]=`storyReview`),P.testPoints&&(i[p(Ee)]=`testPoints`),P.caseReview&&(i[p(be)]=`caseReview`),P.caseBlindspot&&(i[p(Se)]=`caseBlindspot`),P.caseGen)for(let e of re()){let t=(e.promptPath??``).trim();t&&(i[p(t)]=`caseGen`)}return je(i),i})},[P.reqAnalysis,P.storyReview,P.testPoints,P.caseReview,P.caseBlindspot,P.caseGen]);(0,x.useEffect)(()=>{if(!t||!s)return;X();let e=()=>{document.visibilityState===`visible`&&X()};document.addEventListener(`visibilitychange`,e);let n=we(()=>void X());return()=>{document.removeEventListener(`visibilitychange`,e),n()}},[t,s,P.uiAuto,P.reports,P.reqAnalysis,P.storyReview,P.testPoints,P.caseReview,P.caseBlindspot,P.caseGen,X]);let Z=(0,x.useMemo)(()=>Object.keys(A).filter(e=>A[e]),[A]),Q=(0,x.useCallback)(e=>{let t=v(e,I);return!t||t===`system`||fe(e)?``:P[t]===!0?t:``},[I,P]);async function Ie(e){k(!0),D(null);try{await le(`prompts`,e.path)}catch(e){D(e instanceof Error?e.message:String(e))}finally{k(!1)}}async function Le(e){k(!0),D(null);try{await _e(`prompts`,e)}catch(e){D(e instanceof Error?e.message:String(e)),k(!1)}}function Re(e){if(_(e.path)){D(`默认提示词不可删除`);return}if(m(e.path,P)){D(h(e.path,P));return}let t=Q(e.path);if(t){let e=o(t)?.name??t;D(`这份提示词正被「${e}」的项目挂载,先在那里换一份再删除`)}else N({kind:`one`,entry:e})}function ze(e){if(_(e.path)){D(`默认提示词不可改名`);return}if(m(e.path,P)){D(h(e.path,P));return}let t=Q(e.path);if(t){let e=o(t)?.name??t;D(`这份提示词正被「${e}」的项目挂载,先在那里换一份再改名`)}else R(e),H(``)}function Be(e){B(e),H(``)}async function Ve(){let e=M;if(e){N(null),k(!0),D(null);try{if(e.kind===`one`)await d(`prompts`,e.entry.path);else{let t=0;for(let n of e.paths)_(n)||m(n,P)||Q(n)?t+=1:await d(`prompts`,n);t&&D(`有 ${t} 个提示词仍被插件或项目引用,已跳过;先解除引用再删。`),j({})}await Y(),c(e.kind===`one`?`已删除「${e.entry.name}」`:`已删除 ${e.paths.length} 个提示词`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);D(t),c(`删除失败:${t}`,`error`)}finally{k(!1)}}}function He(){a(`promptGen`)?window.location.href=`/workbench/?plugin=promptGen`:D(te(`promptGen`))}let $=(0,x.useCallback)((e,t,n=``)=>{let r=(e===`.`?t:`${e}/${t}`).toLowerCase(),i=T.find(e=>e.path.toLowerCase()===r&&e.path.toLowerCase()!==n.toLowerCase());return i?i.name:``},[T]);async function Ue(e){let t=L;if(!t)return;let n=e.trim();if(!n||n===t.name){R(null),H(``);return}let r=$(u(t.path),n,t.path);if(r)H(`已存在同名文件「${r}」,换个名字再试`);else{k(!0),H(``);try{await oe(`prompts`,t.path,n),R(null),await Y(),c(`已重命名为「${n}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);H(t),c(`重命名失败:${t}`,`error`)}finally{k(!1)}}}async function We(e){let t=z;if(!t)return;let n=e.trim();if(!n)return;let r=$(u(t.path),n);if(r)H(`已存在同名文件「${r}」,换个名字再试`);else{k(!0),H(``);try{let{content:e}=await se(`prompts`,t.path);await ue(`prompts`,u(t.path)===`.`?n:`${u(t.path)}/${n}`,e),B(null),await Y(),c(`已复制为「${n}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);H(t),c(`复制失败:${t}`,`error`)}finally{k(!1)}}}let Ge=M?.kind===`one`?`删除「${M.entry.name}」?将从 ${de(`prompts`)} 中移除。`:M?.kind===`batch`?`确认删除已选中的 ${M.paths.length} 个提示词?此操作不可恢复。`:``;return t?s?g===null?(0,C.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在连接本地文档服务`,children:(0,C.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,C.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):g?(0,C.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,children:[(0,C.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,C.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0`,children:[U.query.trim()?(0,C.jsxs)(C.Fragment,{children:[`匹配 `,(0,C.jsx)(`span`,{className:`font-medium text-stone-800`,children:U.filtered.length}),` 个`,(0,C.jsxs)(`span`,{className:`text-stone-400`,children:[` · 共 `,T.length]})]}):(0,C.jsxs)(C.Fragment,{children:[`共 `,(0,C.jsx)(`span`,{className:`font-medium text-stone-800`,children:T.length}),` 个提示词`]}),Z.length>0?(0,C.jsxs)(`span`,{className:`text-stone-400`,children:[` · 已选 `,Z.length]}):null]}),(0,C.jsx)(`button`,{type:`button`,disabled:O||Z.length===0,onClick:()=>N({kind:`batch`,paths:Z}),className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-red-600 border border-red-200 rounded-lg hover:bg-red-50 disabled:opacity-40`,children:`批量删除`}),(0,C.jsx)(`button`,{type:`button`,disabled:O,onClick:He,className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40`,children:`生成提示词`})]}),E?(0,C.jsx)(`div`,{className:`shrink-0 mx-4 mt-3 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:E}):null,(0,C.jsx)(ge,{resizeKey:`docs:prompts:cols:v1`,files:T,filtered:U.filtered,pageFiles:U.pageFiles,query:U.query,onQuery:U.setQuery,sortBy:U.sortBy,onSortBy:U.setSortBy,page:U.page,totalPages:U.totalPages,pageSize:U.pageSize,onPage:U.setPage,onPageSize:U.setPageSize,busy:O,emptyText:`暂无提示词,点击「生成提示词」前往我的工作台。`,searchPlaceholder:`搜索文件名或路径…`,selectable:e=>!f(e.path,P)&&!Q(e.path),selected:A,onToggleRow:e=>j(t=>({...t,[e]:!t[e]})),onSelectPage:(e,t)=>j(n=>{let r={...n};for(let n of e)t?r[n]=!0:delete r[n];return r}),onRowDoubleClick:e=>void Ie(e),extraColumn:{header:`关联插件`,render:e=>(0,C.jsx)(Ne,{path:e.path,enabled:P,mounted:I})},renderNameAction:e=>(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`button`,{type:`button`,disabled:O,"aria-label":`重命名 ${e.name}`,onClick:()=>ze(e),className:`inline-flex h-6 w-6 items-center justify-center rounded text-stone-400 transition-colors hover:bg-[#e8f0fe] hover:text-[#4176e6] disabled:opacity-40`,children:(0,C.jsx)(b,{name:`pencil`,size:12})}),(0,C.jsx)(`button`,{type:`button`,disabled:O,"aria-label":`复制 ${e.name}`,onClick:()=>Be(e),className:`inline-flex h-6 w-6 items-center justify-center rounded text-stone-400 transition-colors hover:bg-[#e8f0fe] hover:text-[#4176e6] disabled:opacity-40`,children:(0,C.jsx)(b,{name:`copy`,size:12})})]}),renderActions:e=>{let t=f(e.path,P)||!!Q(e.path);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`button`,{type:`button`,disabled:O,onClick:()=>void Le(e),className:`inline-flex h-6 items-center whitespace-nowrap rounded bg-[#4176e6] px-2 text-xs text-white hover:bg-[#3565c7] cursor-pointer disabled:opacity-40`,children:`在会话中打开`}),(0,C.jsx)(`button`,{type:`button`,disabled:O||t,"aria-label":`删除 ${e.name}`,onClick:()=>Re(e),className:`tw-icon-danger inline-flex h-6 w-6 items-center justify-center rounded`,children:(0,C.jsx)(b,{name:`trash`,size:12})})]})}}),(0,C.jsx)(y,{open:L!=null,title:`重命名提示词`,label:`文件名称`,initialValue:L?.name??``,lockExtension:!0,confirmLabel:`保存`,error:V,onClose:()=>{R(null),H(``)},onConfirm:e=>void Ue(e)}),(0,C.jsx)(y,{open:z!=null,title:`复制提示词`,label:`新文件名称`,initialValue:z?z.name.replace(/(\.[^.]+)?$/,e=>`(副本)${e}`):``,lockExtension:!0,confirmLabel:`复制`,error:V,onClose:()=>{B(null),H(``)},onConfirm:e=>void We(e)}),(0,C.jsx)(ne,{open:M!=null,title:M?.kind===`batch`?`批量删除`:`删除提示词`,message:Ge,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>N(null),onConfirm:()=>void Ve()})]}):(0,C.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:`提示词管理需要本地文档服务,当前未就绪。`}):(0,C.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:te(`prompts`)}):(0,C.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,C.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,C.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}export{T as default};
@@ -1 +1 @@
1
- import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,p as r}from"./app-config.CF1xVPmo.js";import{i,o as a,s as o}from"./plugins.CVM1IaoC.js";import{t as s}from"./jsx-runtime.DUg_B_vD.js";import{n as c,t as l}from"./DocsPager.v4kQH163.js";import{t as u}from"./SelectDropdown.Cb-QtC-D.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};
1
+ import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,p as r}from"./app-config.CF1xVPmo.js";import{i,o as a,s as o}from"./plugins.CVM1IaoC.js";import{t as s}from"./jsx-runtime.DUg_B_vD.js";import{n as c,t as l}from"./DocsPager.B9VhI6E3.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};
@@ -0,0 +1,29 @@
1
+ import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.CF1xVPmo.js";import{s as r}from"./plugins.CVM1IaoC.js";import{a as i,i as a,n as o,o as s,r as c,t as l}from"./view-prefs.D1snIG5o.js";import{t as u}from"./jsx-runtime.DUg_B_vD.js";import{t as d}from"./ConfirmDialog.CsMwWevK.js";import{t as f}from"./OverflowHint.pvo2Xc8R.js";import{t as p}from"./SelectDropdown.apWlFGbA.js";import{showToast as m}from"./Toast.BO2NFckG.js";import{A as h,C as g,D as ee,E as te,S as _,T as v,_ as y,a as ne,b as re,c as ie,d as ae,f as oe,h as se,i as ce,j as b,k as le,l as ue,m as de,n as x,o as fe,r as S,s as pe,t as me,u as he,v as ge,w as _e,x as ve,y as ye}from"./req-analysis.dhgy4p2f.js";import{o as be}from"./project-docs.DAw9bzgk.js";import{s as xe}from"./llm.BuR7z55C.js";import{f as Se,l as Ce,p as we}from"./settings.B1yetppp.js";import{a as C,c as Te,d as Ee,f as De,g as Oe,h as ke,i as Ae,l as je,m as Me,n as Ne,o as Pe,p as Fe,r as Ie,s as Le,u as Re,v as ze}from"./story-review.BbdIf5zg.js";import{t as Be}from"./hydrate-cache.CmC22o_H.js";import{S as w,_ as Ve,g as He,k as Ue,m as T,u as We}from"./PmShared.BrBicDMN.js";var E=e(t(),1),Ge=`可用工具(只调用这些,不要自己编工具名):
2
+ - req_set_outline:提交本批「需求条目」,返回每个条目的 id。
3
+ - req_set_stories:提交「用户故事」;补写时提交合并后的完整故事集(带原 id 原地更新)。
4
+ - req_save_check:提交体检结果(缺口清单 + 结论)。
5
+ - req_save_test_points:提交测试点(功能 / 边界值 / 异常 / 业务规则 / 非功能五维,P0–P3)。
6
+
7
+ 提交后不要重复提交同样的内容;工具返回 ok 之后再写最终回答。`,D=[`missing-scenario`,`missing-dimension`,`untestable-acceptance`,`conflict`,`over-split`,`other`];function Ke(e){try{let t=JSON.parse(e||`{}`);return t&&typeof t==`object`?t:{}}catch{return{}}}function O(e,t=500){return typeof e==`string`?e.trim().slice(0,t):``}function qe(e){return String(e??``).toLowerCase().replace(/[\s\p{P}\p{S}]+/gu,``)}function k(e){let t=O(e,10);return t===`high`||t===`medium`||t===`low`?t:`medium`}function Je(e){let t=O(e,40);return D.includes(t)?t:`other`}var A=[`functional`,`boundary`,`exception`,`business`,`nonfunctional`];function Ye(e){let t=O(e,40);if(A.includes(t))return t;let n=O(e,20);return A.find(e=>Le[e]===n)??`functional`}function j(e){let t=O(e,4).toUpperCase();return Re.includes(t)?t:`P1`}function Xe(e,t){if(!e||typeof e!=`object`)return null;let n=e,r=O(n.title,200);if(!r)return null;let i=O(n.storyId,20);return{id:``,storyId:t.has(i)?i:``,dimension:Ye(n.dimension),priority:j(n.priority),title:r,precondition:O(n.precondition,1e3),steps:Array.isArray(n.steps)?n.steps.map(e=>O(e,500)).filter(Boolean).slice(0,20):[],expected:O(n.expected,1e3)}}var Ze=[{type:`function`,function:{name:`req_set_outline`,description:`提交本批从原始需求里抽出的需求条目(一条 = 一个可独立验收的能力点)。返回每个条目的 id,供 sourceRefs 引用。`,parameters:{type:`object`,properties:{items:{type:`array`,items:{type:`object`,properties:{title:{type:`string`,description:`一句话概括`},quote:{type:`string`,description:`原文关键句,不超过 80 字`}},required:[`title`]}}},required:[`items`]}}},{type:`function`,function:{name:`req_set_stories`,description:`提交用户故事。拆解时只提交这一批新故事;补写时提交合并后的完整故事集(带原 id 的原地更新,新故事不带 id)。`,parameters:{type:`object`,properties:{stories:{type:`array`,items:{type:`object`,properties:{id:{type:`string`,description:`已有故事才带(US-001 这种)`},title:{type:`string`,description:`一句话说明这条故事做什么`},role:{type:`string`,description:`角色(来自原文;推断的要在 value 里注明)`},goal:{type:`string`,description:`用户想达成的目标`},value:{type:`string`,description:`业务价值 / 补充说明(角色为推断时写在这里)`},sourceRefs:{type:`array`,items:{type:`string`},description:`对应的需求条目 id(req_set_outline 返回的真实 id)`},priority:{type:`string`,enum:[`P0`,`P1`,`P2`]},preconditions:{type:`array`,items:{type:`string`}},mainFlow:{type:`array`,items:{type:`object`,properties:{actor:{type:`string`},action:{type:`string`,description:`动词开头的一步`},result:{type:`string`,description:`用户能看到的变化`}},required:[`action`]}},altFlows:{type:`array`,items:{type:`object`,properties:{name:{type:`string`},trigger:{type:`string`,description:`什么情况下走这条替代路径`},steps:{type:`array`,items:{type:`string`}}},required:[`name`,`trigger`]}},exceptions:{type:`array`,items:{type:`object`,properties:{scenario:{type:`string`,description:`异常场景`},expected:{type:`string`,description:`系统应有的表现`}},required:[`scenario`,`expected`]}},postconditions:{type:`array`,items:{type:`string`}},acceptance:{type:`array`,items:{type:`object`,properties:{given:{type:`string`},when:{type:`string`},then:{type:`string`,description:`必须可判定`}},required:[`given`,`when`,`then`]}},dimensions:{type:`array`,items:{type:`string`},description:`权限 / 边界值 / 并发与幂等 / 空数据 / 超时与失败 / 国际化与时区`}},required:[`title`,`role`,`mainFlow`,`acceptance`]}}},required:[`stories`]}}},{type:`function`,function:{name:`req_save_check`,description:`提交需求体检结果:语义类缺口清单 + 两三句话结论。只出问题,不改写故事。`,parameters:{type:`object`,properties:{summary:{type:`string`,description:`整体结论,两三句话`},gaps:{type:`array`,items:{type:`object`,properties:{storyTitle:{type:`string`,description:`相关故事标题;全局问题填空串`},type:{type:`string`,enum:D},severity:{type:`string`,enum:[`high`,`medium`,`low`]},title:{type:`string`},detail:{type:`string`,description:`位置 + 原因`},suggestion:{type:`string`,description:`建议补写什么`}},required:[`title`,`detail`]}}},required:[`gaps`]}}},{type:`function`,function:{name:`req_save_test_points`,description:`提交基于用户故事拆出的测试点:功能 / 边界值 / 异常 / 业务规则 / 非功能五个维度全覆盖,每条标 P0–P3。一次提交全部,不要分多次。`,parameters:{type:`object`,properties:{summary:{type:`string`,description:`整体结论:几条、五维覆盖情况、最该先测什么`},points:{type:`array`,items:{type:`object`,properties:{storyId:{type:`string`,description:`对应故事 id(US-001 这种);全局测试点填空串`},dimension:{type:`string`,enum:A,description:`functional 功能 / boundary 边界值 / exception 异常 / business 业务规则 / nonfunctional 非功能`},priority:{type:`string`,enum:Re},title:{type:`string`,description:`一句话说清测什么(动词开头,带条件)`},precondition:{type:`string`,description:`执行前需要的数据 / 角色 / 状态`},steps:{type:`array`,items:{type:`string`},description:`可执行步骤,一步一个动作`},expected:{type:`string`,description:`可判定的预期结果,有阈值写具体数值`}},required:[`dimension`,`priority`,`title`]}}},required:[`points`]}}}];async function Qe(e,t,n){let r=Ke(t),i=n.getDoc();if(!i)return JSON.stringify({ok:!1,error:`当前还没有打开分析文档`});if(e===`req_set_outline`){let e=Array.isArray(r.items)?r.items:[];if(!e.length)return JSON.stringify({ok:!0,added:0,total:i.outline.length,items:i.outline.map(({id:e,title:t})=>({id:e,title:t})),note:`没有提交新条目,需求条目保持不变。`});let t=i.outline,a=new Set(t.map(e=>qe(e.title))),o=new Set(t.map(e=>e.id)),s=[];for(let t of e){let e=t&&typeof t==`object`?t:{},r=O(e.title,200)||O(e.quote,200);if(!r||a.has(qe(r)))continue;a.add(qe(r));let i=`RO-${n.batch+1}-${s.length+1}`,c=i,l=1;for(;o.has(c);)c=`${i}-${l++}`;o.add(c),s.push({id:c,title:r,quote:O(e.quote,500)})}let c=[...t,...s],l=await n.saveOutline(c);return JSON.stringify({ok:!0,added:s.length,total:l.length,items:l.map(({id:e,title:t})=>({id:e,title:t})),note:s.length>0?`条目已保存。接下来用 req_set_stories 提交故事,sourceRefs 只能引用上面返回的 id。`:`这些条目已经存在,没有重复写入;继续提交故事即可。`})}if(e===`req_set_stories`){let e=Array.isArray(r.stories)?r.stories:[];if(!e.length)return JSON.stringify({ok:!0,added:0,total:i.stories.length,note:`没有提交故事,故事集保持不变。`});let t=i.stories.length,a=ve(i.stories,e),o=await n.saveStories(a),s=new Set(i.outline.map(e=>e.id)),c=o.stories.flatMap(e=>e.sourceRefs).filter(e=>!s.has(e));return JSON.stringify({ok:!0,added:Math.max(0,o.stories.length-t),total:o.stories.length,stories:o.stories.map(({id:e,title:t,priority:n})=>({id:e,title:t,priority:n})),danglingSourceRefs:Array.from(new Set(c)).slice(0,10),note:c.length>0?`有些 sourceRefs 不在需求条目里,覆盖率会算不到;需要的话用真实条目 id 修正。`:`故事已保存。`})}if(e===`req_save_check`){let e=ie(i),t=new Map(i.stories.filter(e=>e.title).map(e=>[qe(e.title),e.id])),a=new Set(i.stories.map(e=>e.id)),o=Array.isArray(r.gaps)?r.gaps:[],s=[];for(let e of o){let n=e&&typeof e==`object`?e:{},r=O(n.title,200);if(!r)continue;let i=O(n.storyId,20),o=a.has(i)&&i||t.get(qe(O(n.storyTitle,200)))||``,c=Je(n.type);s.push({id:y(c,o,r),storyId:o,type:c,severity:k(n.severity),title:r,detail:O(n.detail,1e3),suggestion:O(n.suggestion,1e3),origin:`model`,selected:!1})}let c=re(e.gaps,s),l=O(r.summary,1500)||e.summary;return await n.saveCheck({...e,summary:l,gaps:c}),JSON.stringify({ok:!0,gaps:c.length,high:c.filter(e=>e.severity===`high`).length,coverage:e.coverage,dimensions:e.dimensions.map(e=>({label:e.label,covered:e.covered})),note:`体检报告已保存:整体 ${c.length} 个缺口(高 ${c.filter(e=>e.severity===`high`).length} 个),覆盖率 ${Math.round(e.coverage.rate*100)}%。用户可以在页面上勾选缺口补写。`})}if(e===`req_save_test_points`){let e=Array.isArray(r.points)?r.points:[];if(!e.length)return JSON.stringify({ok:!0,total:i.testPoints?.points.length??0,note:`没有提交测试点,原结果保持不变。`});if(typeof n.saveTestPoints!=`function`)return JSON.stringify({ok:!1,error:`当前上下文不支持保存测试点`});let t=new Set(i.stories.map(e=>e.id)),a=e.slice(0,500).map(e=>Xe(e,t)).filter(e=>e!==null);if(!a.length)return JSON.stringify({ok:!1,error:`测试点都缺少标题,没有保存`});let o=(await n.saveTestPoints({at:new Date().toISOString(),summary:O(r.summary,2e3),points:a})).testPoints?.points??a,s=A.map(e=>({dimension:Le[e],count:o.filter(t=>t.dimension===e).length})),c=Re.map(e=>({priority:e,count:o.filter(t=>t.priority===e).length})),l=s.filter(e=>e.count===0).map(e=>e.dimension);return JSON.stringify({ok:!0,total:o.length,byDimension:s,byPriority:c,uncoveredDimensions:l,note:l.length>0?`测试点已保存:整体 ${o.length} 条。${l.join(`、`)}还没有测试点,如确实不适用请在回答里说明。`:`测试点已保存:整体 ${o.length} 条,五个维度都有覆盖。`})}return JSON.stringify({ok:!1,error:`未知工具:${e}`})}function M(e){let t=[],n=/```json\s*([\s\S]*?)```/gi,r;for(;(r=n.exec(e))!==null;)r[1]?.trim()&&t.push(r[1].trim());return t}function $e(e){let t=M(String(e??``));for(let e of t)try{let t=JSON.parse(e),n=Array.isArray(t)?t:t&&typeof t==`object`&&Array.isArray(t.stories)?t.stories:null;if(!n?.length)continue;let r=n.filter(e=>!!(e&&typeof e==`object`&&typeof e.title==`string`));if(r.length)return r}catch{}return[]}function et(e,t=[]){let n=new Set(t),r=M(String(e??``));for(let e of r)try{let t=JSON.parse(e),r=Array.isArray(t)?t:t&&typeof t==`object`&&Array.isArray(t.points)?t.points:null;if(!r?.length)continue;let i=r.map(e=>Xe(e,n)).filter(e=>e!==null);if(!i.length)continue;let a=t&&typeof t==`object`&&!Array.isArray(t)?O(t.summary,2e3):``;return{at:new Date().toISOString(),summary:a,points:i}}catch{}return null}var N=u(),P=`text-xs font-semibold tracking-wide text-stone-500`,tt=`inline-flex h-7 items-center justify-center rounded-md bg-[#3370ff] px-2.5 text-xs font-medium text-white transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50`,F=`inline-flex h-7 items-center justify-center rounded-md border border-stone-200 bg-white px-2 text-xs text-stone-600 transition-colors hover:bg-stone-50 disabled:cursor-not-allowed disabled:opacity-50`;function nt({check:e,stories:t,busy:n,onToggleGap:r,onToggleAll:i,onFix:a,onReview:o,onExport:s}){if(!e)return(0,N.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-xl border border-dashed border-stone-200 px-4 py-16 text-center`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-stone-600`,children:`还没有审查结果`}),(0,N.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-relaxed text-stone-400`,children:`审查会先用固定规则核对覆盖率与字段完整性,再让模型专查场景遗漏与维度缺失(替代流程不成立、验收不可测也会一并报)。`}),(0,N.jsx)(`button`,{type:`button`,className:`mt-4 h-9 rounded-md bg-[#3370ff] px-4 text-sm font-medium text-white transition-opacity hover:opacity-90 disabled:opacity-50`,disabled:n||!t.length,onClick:o,children:`开始审查`})]});let c=C(e.gaps),l=e.gaps.filter(e=>e.selected).length,u=e.coverage.total?Math.round(e.coverage.rate*100):0,d=Ne(e.gaps),p=new Map(t.map(e=>[e.id,e.title]));return(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl border border-stone-200 bg-white px-4 py-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:P,children:`需求条目覆盖率`}),(0,N.jsxs)(`p`,{className:`mt-0.5 text-lg font-semibold text-stone-800`,children:[e.coverage.covered,(0,N.jsxs)(`span`,{className:`text-sm font-normal text-stone-400`,children:[` / `,e.coverage.total]}),(0,N.jsxs)(`span`,{className:`ml-2 text-sm font-normal text-stone-500`,children:[u,`%`]})]})]}),(0,N.jsxs)(`div`,{className:`min-w-[160px] flex-1`,children:[(0,N.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-stone-100`,children:(0,N.jsx)(`div`,{className:`h-full rounded-full transition-all ${u>=90?`bg-emerald-500`:u>=60?`bg-amber-500`:`bg-red-500`}`,style:{width:`${Math.max(u,e.coverage.total?2:0)}%`}})}),(0,N.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:e.coverage.total?`有故事引用的条目算覆盖;sourceRefs 为空的故事不会计入`:`还没有需求条目,先回「需求分析」做一次拆解`})]}),(0,N.jsxs)(`div`,{className:`text-right`,children:[(0,N.jsx)(`p`,{className:P,children:`缺口`}),(0,N.jsxs)(`p`,{className:`mt-0.5 text-lg font-semibold text-stone-800`,children:[e.gaps.length,(0,N.jsxs)(`span`,{className:`ml-1.5 text-xs font-normal text-stone-400`,children:[`高 `,d.high,` · 中 `,d.medium,` · 低 `,d.low]})]})]})]}),e.summary?(0,N.jsx)(`p`,{className:`mt-3 border-t border-stone-100 pt-2 text-xs leading-relaxed text-stone-500`,children:e.summary}):null]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-stone-200 bg-white px-4 py-3`,children:[(0,N.jsx)(`p`,{className:P,children:`维度覆盖`}),(0,N.jsx)(`div`,{className:`mt-2 grid gap-1.5 sm:grid-cols-2 lg:grid-cols-3`,children:e.dimensions.map(e=>{let t=e.stories.join(`, `);return(0,N.jsxs)(`div`,{"data-hint-width":!0,className:`min-w-0 rounded-lg border px-2.5 py-1.5 text-xs ${e.covered?`border-emerald-200 bg-emerald-50/60`:`border-stone-200 bg-stone-50`}`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,N.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 ${e.covered?`text-emerald-600`:`text-stone-400`}`,children:e.covered?`✓`:`—`}),(0,N.jsx)(`span`,{className:`shrink-0 whitespace-nowrap font-medium ${e.covered?`text-emerald-800`:`text-stone-500`}`,children:e.label}),(0,N.jsx)(`span`,{className:`ml-auto shrink-0 text-[11px] tabular-nums text-stone-400`,children:e.stories.length?`${e.stories.length} 条`:`未覆盖`})]}),(0,N.jsx)(`div`,{className:`mt-0.5 min-w-0 pl-[18px]`,children:t?(0,N.jsx)(f,{text:t,matchAnchorWidth:!0,className:`block truncate text-[11px] text-stone-400`}):(0,N.jsx)(`span`,{className:`text-[11px] text-stone-300`,children:`没有故事覆盖`})})]},e.key)})})]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-stone-200 bg-white`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-stone-100 px-4 py-2.5`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-stone-700`,children:`缺口清单`}),(0,N.jsxs)(`span`,{className:`text-xs text-stone-400`,children:[`已选 `,l,` 条`]})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`button`,{type:`button`,className:F,onClick:s,children:`导出 Markdown`}),(0,N.jsx)(`button`,{type:`button`,className:F,onClick:()=>i(l!==e.gaps.length),children:l===e.gaps.length&&e.gaps.length?`清空选择`:`全选`}),(0,N.jsx)(`button`,{type:`button`,className:tt,disabled:n||!l,onClick:a,children:`补写选中缺口`})]})]}),c.length?(0,N.jsx)(`div`,{className:`divide-y divide-stone-100`,children:c.map(e=>(0,N.jsxs)(`section`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 bg-stone-50/60 px-4 py-1.5`,children:[(0,N.jsx)(`p`,{className:`text-xs font-semibold text-stone-600`,children:e.label}),(0,N.jsx)(`span`,{className:`rounded bg-white px-1.5 py-0.5 text-[11px] text-stone-500`,children:e.gaps.length}),(0,N.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:e.hint})]}),(0,N.jsx)(`ul`,{className:`divide-y divide-stone-100`,children:e.gaps.map(e=>(0,N.jsx)(rt,{gap:e,storyTitle:p.get(e.storyId)??``,onToggle:r},e.id))})]},e.key))}):(0,N.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-stone-400`,children:`没有发现缺口。覆盖率与维度都过了,可以再人工过一遍验收标准。`})]})]})}function rt({gap:e,storyTitle:t,onToggle:n}){return(0,N.jsxs)(`li`,{className:`flex items-start gap-2.5 px-4 py-2.5`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`mt-1 h-3.5 w-3.5 shrink-0 accent-[#3370ff]`,checked:e.selected,onChange:t=>n(e.id,t.target.checked)}),(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,N.jsx)(w,{tone:x[e.severity],children:me[e.severity]}),(0,N.jsx)(`span`,{className:`rounded bg-stone-100 px-1.5 py-0.5 text-[11px] text-stone-500`,children:S[e.type]}),e.storyId?(0,N.jsxs)(`span`,{className:`font-mono text-[11px] text-stone-400`,children:[e.storyId,t?` · ${t}`:``]}):(0,N.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:`全局`}),(0,N.jsx)(`span`,{className:`text-[11px] text-stone-300`,children:e.origin===`model`?`模型`:`规则`})]}),(0,N.jsx)(`p`,{className:`mt-0.5 text-sm text-stone-800`,children:e.title}),e.detail?(0,N.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-stone-500`,children:e.detail}):null,e.suggestion?(0,N.jsxs)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-amber-700`,children:[`建议:`,e.suggestion]}):null]})]})}var it=`reqanalysis.testPointsView`,at=[`map`,`list`],I=`inline-flex h-7 items-center justify-center rounded-md border border-stone-200 bg-white px-2 text-xs text-stone-600 transition-colors hover:bg-stone-50 disabled:cursor-not-allowed disabled:opacity-50`;function ot({point:e}){return(0,N.jsxs)(`div`,{className:`space-y-1 text-[11px] leading-relaxed text-stone-500`,children:[e.precondition?(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`span`,{className:`text-stone-400`,children:`前置:`}),e.precondition]}):null,e.steps.length?(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`text-stone-400`,children:`步骤:`}),(0,N.jsx)(`ol`,{className:`mt-0.5 list-decimal space-y-0.5 pl-4`,children:e.steps.map((e,t)=>(0,N.jsx)(`li`,{children:e},t))})]}):null,e.expected?(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`span`,{className:`text-stone-400`,children:`预期:`}),e.expected]}):null]})}function L({req:e}){return(0,N.jsxs)(`div`,{className:`flex items-stretch gap-0`,children:[(0,N.jsxs)(`div`,{className:`flex w-36 shrink-0 flex-col justify-center rounded-l-xl border border-r-0 border-[#c9d8ff] bg-[#f5f8ff] px-3 py-3`,children:[(0,N.jsx)(`p`,{className:`text-[11px] text-[#5b7fd6]`,children:`需求`}),(0,N.jsx)(`p`,{className:`text-sm font-semibold leading-snug text-stone-800`,children:e.title}),(0,N.jsxs)(`p`,{className:`mt-1 text-[11px] tabular-nums text-stone-400`,children:[e.points.length,` 条`]})]}),(0,N.jsx)(`div`,{className:`flex min-w-0 flex-1 overflow-hidden rounded-r-xl border border-stone-200 bg-white`,children:e.dimensions.map((e,t)=>{let n=Te[e.key];return(0,N.jsxs)(`div`,{className:`flex w-[9.5rem] shrink-0 flex-col ${t>0?`border-l border-stone-100`:``}`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-1 border-b border-stone-100 px-2 py-1.5`,children:[(0,N.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${n.accent}`,"aria-hidden":`true`}),(0,N.jsx)(`span`,{className:`truncate text-[11px] font-medium text-stone-700`,children:n.label})]}),(0,N.jsx)(`span`,{className:`shrink-0 text-[10px] tabular-nums text-stone-400`,children:e.points.length})]}),(0,N.jsx)(`div`,{className:`max-h-52 space-y-1.5 overflow-y-auto px-1.5 py-1.5`,children:e.points.length?e.points.map(e=>(0,N.jsx)(`div`,{className:`rounded-lg border border-stone-100 bg-stone-50/70 px-1.5 py-1`,children:(0,N.jsxs)(`div`,{className:`flex items-start gap-1`,children:[(0,N.jsx)(w,{tone:je[e.priority].tone,children:e.priority}),(0,N.jsx)(`p`,{className:`min-w-0 flex-1 break-words text-[11px] leading-snug text-stone-700`,children:e.title})]})},e.id)):(0,N.jsx)(`p`,{className:`py-3 text-center text-[11px] text-stone-300`,children:`无`})})]},e.key)})})]})}function R({doc:e,idealTitles:t}){let n=(0,E.useMemo)(()=>Oe(e,t),[e,t]);return(0,N.jsxs)(`div`,{className:`space-y-3`,children:[(0,N.jsx)(`div`,{className:`overflow-x-auto pb-1`,children:(0,N.jsx)(`div`,{className:`min-w-[62rem] space-y-3`,children:n.length?n.map(e=>(0,N.jsx)(L,{req:e},e.key)):(0,N.jsx)(`p`,{className:`py-8 text-center text-xs text-stone-400`,children:`还没有测试点。`})})}),(0,N.jsx)(`p`,{className:`text-center text-[11px] text-stone-400`,children:`每条需求横向展开五个维度;列过窄时整行左右滑动。导出 XMind 为同结构的向右逻辑图。`})]})}function z({doc:e,idealTitles:t}){let n=(0,E.useMemo)(()=>Oe(e,t),[e,t]);return(0,N.jsx)(`div`,{className:`space-y-3`,children:n.map(e=>(0,N.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,N.jsxs)(`div`,{className:`border-b border-stone-100 bg-[#f8fafc] px-3.5 py-2.5`,children:[(0,N.jsx)(`p`,{className:`text-[11px] text-stone-400`,children:`需求`}),(0,N.jsx)(`p`,{className:`text-sm font-semibold text-stone-800`,children:e.title}),(0,N.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-stone-400`,children:[e.points.length,` 条`]})]}),(0,N.jsx)(`div`,{className:`divide-y divide-stone-100`,children:e.dimensions.map(e=>(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3.5 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${Te[e.key].accent}`,"aria-hidden":`true`}),(0,N.jsx)(`span`,{className:`text-xs font-medium text-stone-700`,children:e.label}),(0,N.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-stone-400`,children:e.hint})]}),(0,N.jsx)(`span`,{className:`shrink-0 text-[11px] tabular-nums text-stone-400`,children:e.points.length})]}),e.points.length?(0,N.jsx)(`ul`,{className:`border-t border-stone-50`,children:e.points.map(e=>(0,N.jsx)(`li`,{className:`border-t border-stone-50 first:border-t-0`,children:(0,N.jsxs)(`details`,{className:`group px-3.5 py-2 pl-8`,children:[(0,N.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-start gap-2`,children:[(0,N.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:(0,N.jsx)(w,{tone:je[e.priority].tone,children:e.priority})}),(0,N.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,N.jsx)(`span`,{className:`block text-sm text-stone-800`,children:e.title}),(0,N.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-1.5 text-[11px] text-stone-400`,children:[(0,N.jsxs)(`span`,{children:[e.steps.length,` 步`]}),e.expected?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`span`,{className:`text-stone-300`,children:`·`}),(0,N.jsx)(f,{text:e.expected,className:`min-w-0 flex-1 truncate`})]}):null]})]}),(0,N.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[11px] text-stone-300 group-open:hidden`,children:`展开`}),(0,N.jsx)(`span`,{className:`mt-0.5 hidden shrink-0 text-[11px] text-stone-300 group-open:inline`,children:`收起`})]}),(0,N.jsx)(`div`,{className:`mt-1.5 border-l-2 border-stone-100 pl-2.5`,children:(0,N.jsx)(ot,{point:e})})]})},e.id))}):(0,N.jsx)(`p`,{className:`px-3.5 py-2 pl-8 text-[11px] text-stone-300`,children:`本维度没有测试点。`})]},e.key))})]},e.key))})}function st({doc:e,idealTitles:t=[],generating:n,busy:r,promptReady:a,onExportXmind:s,onExportMarkdown:c}){let[l,u]=(0,E.useState)(()=>o(it,at,`map`)),d=e.testPoints,f=De(d),p=!!e.sourcePath&&t.length===0,m=(0,E.useMemo)(()=>p?0:Oe(e,t).length,[e,t,p]),h=e=>{u(e),i(it,e)};if(!d){let t=e.stories.length?a?``:`「测试点生成提示词.md」还没就绪,重新打开插件会自动补齐`:`还没有用户故事,先做一次拆解`;return(0,N.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-xl border border-dashed border-stone-200 px-4 py-16 text-center`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-stone-600`,children:`还没有测试点`}),(0,N.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-relaxed text-stone-400`,children:`按需求文档每一行整理标题,再按功能 / 边界值 / 异常 / 业务规则 / 非功能拆测试点;导图左右展开,可导出 XMind(向右逻辑图)与 Markdown。`}),t?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-amber-700`,children:t}):null,(0,N.jsx)(`p`,{className:`mt-3 text-xs text-stone-400`,children:n?`正在生成测试点,完成后会自动出现在这里。`:`用左栏的「生成测试点」开始拆。`})]})}return(0,N.jsxs)(`div`,{className:`space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 rounded-xl border border-stone-200 bg-white px-3.5 py-2`,children:[(0,N.jsxs)(`span`,{className:`text-xs text-stone-500`,children:[`需求 `,(0,N.jsx)(`span`,{className:`font-medium text-stone-700`,children:m}),` · 测试点`,` `,(0,N.jsx)(`span`,{className:`font-medium text-stone-700`,children:f.total})]}),(0,N.jsx)(`span`,{className:`flex items-center gap-1`,children:Re.map(e=>(0,N.jsxs)(w,{tone:je[e].tone,children:[e,` `,f.byPriority[e]]},e))}),(0,N.jsxs)(`span`,{className:`text-xs text-stone-400`,children:[`维度覆盖 `,f.coveredDimensions,`/5`]}),(0,N.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`flex overflow-hidden rounded-md border border-stone-200`,children:[{id:`map`,label:`导图`},{id:`list`,label:`列表`}].map(e=>(0,N.jsx)(`button`,{type:`button`,className:`h-7 px-2.5 text-xs transition-colors ${l===e.id?`bg-[#eef3ff] font-medium text-[#1f4fd8]`:`bg-white text-stone-500 hover:bg-stone-50`}`,onClick:()=>h(e.id),children:e.label},e.id))}),(0,N.jsx)(`button`,{type:`button`,className:I,disabled:r,onClick:s,children:`导出 XMind`}),(0,N.jsx)(`button`,{type:`button`,className:I,disabled:r,onClick:c,children:`导出 Markdown`})]})]}),p?(0,N.jsxs)(`div`,{className:`flex items-center justify-center gap-2 rounded-xl border border-dashed border-stone-200 py-16 text-xs text-stone-400`,"aria-busy":`true`,children:[(0,N.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`}),`正在按需求文档行整理…`]}):l===`map`?(0,N.jsx)(R,{doc:e,idealTitles:t}):(0,N.jsx)(z,{doc:e,idealTitles:t}),d.summary?(0,N.jsxs)(`details`,{className:`rounded-xl border border-stone-200 bg-white px-3.5 py-2`,children:[(0,N.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-stone-600`,children:`生成说明`}),(0,N.jsx)(`p`,{className:`mt-1.5 text-xs leading-relaxed whitespace-pre-wrap text-stone-500`,children:d.summary})]}):null]})}var ct=[{value:`P0`,label:`P0 · 必须做`},{value:`P1`,label:`P1 · 应该做`},{value:`P2`,label:`P2 · 可以做`}],lt=`h-9 w-full rounded-md border border-stone-200 bg-white px-2 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff] placeholder:text-stone-400`,ut=`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`,B=`text-xs font-semibold tracking-wide text-stone-500`,dt=`text-[11px] font-medium tracking-wide text-stone-400`,ft={P0:`bg-red-400`,P1:`bg-amber-400`,P2:`bg-stone-300`};function V({label:e,children:t}){return(0,N.jsxs)(`div`,{className:`grid gap-1 sm:grid-cols-[88px_minmax(0,1fr)] sm:gap-3`,children:[(0,N.jsx)(`p`,{className:`${dt} pt-0.5`,children:e}),(0,N.jsx)(`div`,{className:`min-w-0 text-[13px] leading-relaxed text-stone-700`,children:t})]})}function H(e){return e.split(`
8
+ `).map(e=>e.trim()).filter(Boolean)}function pt({label:e,value:t,placeholder:n,onChange:r}){return(0,N.jsxs)(`label`,{className:`block`,children:[(0,N.jsxs)(`span`,{className:B,children:[e,`(一行一条)`]}),(0,N.jsx)(`textarea`,{className:`${ut} mt-1 min-h-[64px]`,value:t.join(`
9
+ `),placeholder:n,onChange:e=>r(H(e.target.value))})]})}function U({value:e,onChange:t}){return(0,N.jsxs)(`label`,{className:`block`,children:[(0,N.jsx)(`span`,{className:B,children:`主流程(一行一步:动作 -> 结果)`}),(0,N.jsx)(`textarea`,{className:`${ut} mt-1 min-h-[80px]`,value:e.map(e=>e.result?`${e.action} -> ${e.result}`:e.action).join(`
10
+ `),placeholder:`填写申请单 -> 进入待审批`,onChange:e=>t(H(e.target.value).map(e=>{let t=e.indexOf(`->`)>=0?e.indexOf(`->`):e.indexOf(`→`);return t<0?{action:e}:{action:e.slice(0,t).trim(),result:e.slice(t+(e.startsWith(`->`,t)?2:1)).trim()}}))})]})}function mt({value:e,onChange:t}){let n=e.map(e=>[`${e.name} | ${e.trigger}`,...e.steps.map((e,t)=>`${t+1}. ${e}`)].join(`
11
+ `)).join(`
12
+
13
+ `);return(0,N.jsxs)(`label`,{className:`block`,children:[(0,N.jsx)(`span`,{className:B,children:`替代流程(空行分段:名称 | 触发条件,下面写步骤)`}),(0,N.jsx)(`textarea`,{className:`${ut} mt-1 min-h-[80px]`,value:n,placeholder:`转人工审批 | 金额超过 5 万
14
+ 1. 提交后进入人工队列
15
+ 2. 审批通过再继续`,onChange:e=>t(e.target.value.split(/\n{2,}/).map(e=>{let t=e.split(`
16
+ `).map(e=>e.trim()).filter(Boolean),[n,r]=(t.shift()??``).split(`|`);return{name:(n??``).trim()||`替代流程`,trigger:(r??``).trim(),steps:t.map(e=>e.replace(/^\d+[.、)]\s*/,``))}}).filter(e=>e.name!==`替代流程`||e.steps.length||e.trigger))})]})}function ht({value:e,onChange:t}){return(0,N.jsxs)(`label`,{className:`block`,children:[(0,N.jsx)(`span`,{className:B,children:`异常场景(一行一条:场景 -> 预期)`}),(0,N.jsx)(`textarea`,{className:`${ut} mt-1 min-h-[80px]`,value:e.map(e=>e.expected?`${e.scenario} -> ${e.expected}`:e.scenario).join(`
17
+ `),placeholder:`提交时网络中断 -> 提示重试并保留草稿`,onChange:e=>t(H(e.target.value).map(e=>{let t=e.indexOf(`->`)>=0?e.indexOf(`->`):e.indexOf(`→`);return t<0?{scenario:e,expected:``}:{scenario:e.slice(0,t).trim(),expected:e.slice(t+(e.startsWith(`->`,t)?2:1)).trim()}}))})]})}function gt({value:e,onChange:t}){return(0,N.jsxs)(`label`,{className:`block`,children:[(0,N.jsx)(`span`,{className:B,children:`验收标准(一行一条:Given | When | Then)`}),(0,N.jsx)(`textarea`,{className:`${ut} mt-1 min-h-[80px]`,value:e.map(e=>`${e.given} | ${e.when} | ${e.then}`).join(`
18
+ `),placeholder:`已登录且有权限 | 提交申请单 | 列表里出现一条待审批记录`,onChange:e=>t(H(e.target.value).map(e=>{let[t=``,n=``,r=``]=e.split(`|`).map(e=>e.trim());return{given:t,when:n,then:r}}))})]})}function _t({story:e,index:t,total:n,gaps:r,busy:i,onSave:a,onDelete:o,onMove:s,domId:c}){let[l,u]=(0,E.useState)(!1),[d,f]=(0,E.useState)(!1),[m,h]=(0,E.useState)(e),[g,ee]=(0,E.useState)(!1);(0,E.useEffect)(()=>{if(l||d){ee(!0);return}let e=window.setTimeout(()=>ee(!1),200);return()=>window.clearTimeout(e)},[l,d]);let te=()=>{h({...e}),f(!0),u(!0)},_=e=>h(t=>({...t,...e})),v=r.filter(e=>e.severity===`high`).length;return(0,N.jsxs)(`li`,{id:c,className:`overflow-hidden rounded-xl border bg-white transition-colors ${l||d?`border-stone-200 shadow-sm`:`border-stone-200 hover:border-stone-300`}`,children:[(0,N.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":l,"aria-label":l?`收起 ${e.id}`:`展开 ${e.id}`,className:`flex cursor-pointer items-start gap-3 px-3.5 py-3 outline-none transition-colors hover:bg-stone-50/70 focus-visible:bg-stone-50/70`,onClick:()=>u(e=>!e),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),u(e=>!e))},children:[(0,N.jsx)(`span`,{className:`mt-1 h-9 w-[3px] shrink-0 rounded-full ${ft[e.priority]}`,"aria-hidden":`true`}),(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`rounded bg-stone-100 px-1.5 py-0.5 font-mono text-[11px] text-stone-500`,children:e.id||`待编号`}),(0,N.jsx)(w,{tone:fe[e.priority],children:e.priority}),(0,N.jsx)(`span`,{className:`truncate text-sm font-medium text-stone-800`,children:e.title}),r.length>0?(0,N.jsxs)(w,{tone:v?`red`:`amber`,children:[r.length,` 个缺口`,v?` · 高 ${v}`:``]}):null]}),(0,N.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs text-stone-500`,children:[e.role&&`角色:${e.role}`,e.goal&&`目标:${e.goal}`].filter(Boolean).join(` · `)||`还没有写角色与目标`}),l?null:(0,N.jsxs)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:[`验收 `,e.acceptance.length,` · 异常 `,e.exceptions.length,` · 维度`,` `,e.dimensions.length]})]}),(0,N.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[(0,N.jsx)(`button`,{type:`button`,className:`rounded p-1 text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-600 disabled:opacity-30`,"aria-label":`上移`,disabled:i||t===0,onClick:()=>s(-1),children:(0,N.jsx)(T,{name:`chevronRight`,size:14,className:`-rotate-90`})}),(0,N.jsx)(`button`,{type:`button`,className:`rounded p-1 text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-600 disabled:opacity-30`,"aria-label":`下移`,disabled:i||t>=n-1,onClick:()=>s(1),children:(0,N.jsx)(T,{name:`chevronRight`,size:14,className:`rotate-90`})}),(0,N.jsx)(`button`,{type:`button`,className:`rounded p-1 text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-600`,"aria-label":d?`取消编辑`:`编辑`,onClick:()=>d?f(!1):te(),children:(0,N.jsx)(T,{name:`pencil`,size:14})}),(0,N.jsx)(`button`,{type:`button`,className:`tw-icon-danger rounded p-1`,"aria-label":`删除`,disabled:i,onClick:o,children:(0,N.jsx)(T,{name:`trash`,size:14})}),(0,N.jsx)(T,{name:`chevronRight`,size:14,className:`ml-1 text-stone-300 transition-transform duration-150 ${l||d?`rotate-90`:``}`})]})]}),(0,N.jsx)(`div`,{className:`grid transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none ${l||d?`grid-rows-[1fr]`:`grid-rows-[0fr]`}`,children:(0,N.jsxs)(`div`,{className:`min-h-0 overflow-hidden`,children:[g&&d?(0,N.jsxs)(`div`,{className:`space-y-3 border-t border-stone-100 px-4 py-3`,children:[(0,N.jsxs)(`label`,{className:`block`,children:[(0,N.jsx)(`span`,{className:B,children:`标题`}),(0,N.jsx)(`input`,{className:`${lt} mt-1`,value:m.title,onChange:e=>_({title:e.target.value})})]}),(0,N.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,N.jsxs)(`label`,{className:`block`,children:[(0,N.jsx)(`span`,{className:B,children:`角色`}),(0,N.jsx)(`input`,{className:`${lt} mt-1`,value:m.role,onChange:e=>_({role:e.target.value})})]}),(0,N.jsxs)(`label`,{className:`block`,children:[(0,N.jsx)(`span`,{className:B,children:`优先级`}),(0,N.jsx)(`div`,{className:`mt-1`,children:(0,N.jsx)(p,{options:ct,value:m.priority,onChange:e=>_({priority:e}),ariaLabel:`优先级`,flat:!0})})]})]}),(0,N.jsxs)(`label`,{className:`block`,children:[(0,N.jsx)(`span`,{className:B,children:`目标`}),(0,N.jsx)(`input`,{className:`${lt} mt-1`,value:m.goal,onChange:e=>_({goal:e.target.value})})]}),(0,N.jsxs)(`label`,{className:`block`,children:[(0,N.jsx)(`span`,{className:B,children:`价值 / 备注`}),(0,N.jsx)(`input`,{className:`${lt} mt-1`,value:m.value,onChange:e=>_({value:e.target.value})})]}),(0,N.jsx)(pt,{label:`前置条件`,value:m.preconditions,placeholder:`已登录且拥有申请权限`,onChange:e=>_({preconditions:e})}),(0,N.jsx)(U,{value:m.mainFlow,onChange:e=>_({mainFlow:e})}),(0,N.jsx)(mt,{value:m.altFlows,onChange:e=>_({altFlows:e})}),(0,N.jsx)(ht,{value:m.exceptions,onChange:e=>_({exceptions:e})}),(0,N.jsx)(pt,{label:`后置条件`,value:m.postconditions,placeholder:`申请单状态变为待审批`,onChange:e=>_({postconditions:e})}),(0,N.jsx)(gt,{value:m.acceptance,onChange:e=>_({acceptance:e})}),(0,N.jsx)(pt,{label:`覆盖维度`,value:m.dimensions,placeholder:`权限、边界值、超时与失败`,onChange:e=>_({dimensions:e})}),(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,N.jsxs)(`span`,{className:`text-xs text-stone-400`,children:[`来源条目:`,e.sourceRefs.join(`、`)||`(未关联)`]}),(0,N.jsxs)(`div`,{className:`flex gap-2`,children:[(0,N.jsx)(`button`,{type:`button`,className:`h-8 rounded-md border border-stone-200 px-3 text-xs text-stone-600 transition-colors hover:bg-stone-50`,onClick:()=>f(!1),children:`取消`}),(0,N.jsx)(`button`,{type:`button`,className:`h-8 rounded-md bg-[#3370ff] px-3 text-xs font-medium text-white transition-opacity hover:opacity-90 disabled:opacity-50`,disabled:i||!m.title.trim(),onClick:()=>{a(m),f(!1)},children:`保存`})]})]})]}):null,g&&!d?(0,N.jsxs)(`div`,{className:`border-t border-stone-100 bg-stone-50/50 px-3.5 py-3.5`,children:[(0,N.jsxs)(`div`,{className:`space-y-3.5`,children:[e.value?(0,N.jsx)(V,{label:`价值`,children:e.value}):null,e.preconditions.length?(0,N.jsx)(V,{label:`前置条件`,children:(0,N.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-4`,children:e.preconditions.map((e,t)=>(0,N.jsx)(`li`,{children:e},t))})}):null,e.mainFlow.length?(0,N.jsx)(V,{label:`主流程`,children:(0,N.jsx)(`ol`,{className:`list-decimal space-y-0.5 pl-4`,children:e.mainFlow.map((e,t)=>(0,N.jsxs)(`li`,{children:[e.actor?(0,N.jsxs)(`span`,{className:`text-stone-500`,children:[e.actor,`:`]}):null,e.action,e.result?(0,N.jsxs)(`span`,{className:`text-stone-500`,children:[` → `,e.result]}):null]},t))})}):null,e.altFlows.length?(0,N.jsx)(V,{label:`替代流程`,children:(0,N.jsx)(`ul`,{className:`space-y-1.5`,children:e.altFlows.map((e,t)=>(0,N.jsxs)(`li`,{children:[(0,N.jsxs)(`p`,{className:`font-medium text-stone-700`,children:[e.name,e.trigger?(0,N.jsxs)(`span`,{className:`font-normal text-stone-500`,children:[`(触发:`,e.trigger,`)`]}):null]}),(0,N.jsx)(`ol`,{className:`mt-0.5 list-decimal space-y-0.5 pl-4 text-stone-600`,children:e.steps.map((e,t)=>(0,N.jsx)(`li`,{children:e},t))})]},t))})}):null,e.exceptions.length?(0,N.jsx)(V,{label:`异常场景`,children:(0,N.jsx)(`ul`,{className:`space-y-0.5`,children:e.exceptions.map((e,t)=>(0,N.jsxs)(`li`,{children:[e.scenario,e.expected?(0,N.jsxs)(`span`,{className:`text-stone-500`,children:[` → `,e.expected]}):null]},t))})}):null,e.postconditions.length?(0,N.jsx)(V,{label:`后置条件`,children:(0,N.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-4`,children:e.postconditions.map((e,t)=>(0,N.jsx)(`li`,{children:e},t))})}):null,e.acceptance.length?(0,N.jsx)(V,{label:`验收标准`,children:(0,N.jsx)(`ul`,{className:`space-y-1`,children:e.acceptance.map((e,t)=>(0,N.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5 rounded-md bg-white px-2 py-1 ring-1 ring-stone-100`,children:[(0,N.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:`Given`}),(0,N.jsx)(`span`,{children:e.given||`—`}),(0,N.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:`When`}),(0,N.jsx)(`span`,{children:e.when||`—`}),(0,N.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:`Then`}),(0,N.jsx)(`span`,{className:e.then?`text-stone-800`:`text-red-500`,children:e.then||`(未写)`})]},t))})}):null,e.dimensions.length?(0,N.jsx)(V,{label:`覆盖维度`,children:(0,N.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.dimensions.map(e=>(0,N.jsx)(`span`,{className:`rounded bg-white px-1.5 py-0.5 text-[11px] text-stone-500 ring-1 ring-stone-100`,children:e},e))})}):null,(0,N.jsx)(V,{label:`来源条目`,children:(0,N.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.sourceRefs.length?e.sourceRefs.map(e=>(0,N.jsx)(`span`,{className:`rounded bg-white px-1.5 py-0.5 font-mono text-[11px] text-stone-500 ring-1 ring-stone-100`,children:e},e)):(0,N.jsx)(`span`,{className:`text-amber-600`,children:`未关联(覆盖率会算不到)`})})})]}),r.length?(0,N.jsxs)(`div`,{className:`mt-3 rounded-lg border border-amber-200 bg-amber-50/70 px-3 py-2`,children:[(0,N.jsx)(`p`,{className:`text-xs font-medium text-amber-900`,children:`审查发现的问题`}),(0,N.jsx)(`ul`,{className:`mt-1 space-y-1`,children:r.map(e=>(0,N.jsxs)(`li`,{className:`flex flex-wrap items-center gap-1.5 text-xs`,children:[(0,N.jsx)(w,{tone:x[e.severity],children:me[e.severity]}),(0,N.jsx)(`span`,{className:`text-stone-500`,children:S[e.type]}),(0,N.jsx)(`span`,{className:`text-stone-700`,children:e.title})]},e.id))})]}):null]}):null]})})]})}var vt=`reqanalysis.doc`,yt=`reqanalysis.listmode`,bt=`reqanalysis.view`,xt=`reqanalysis.tab`,St=`reqanalysis.storykeyword`,Ct=[`list`,`work`],wt=[`stories`,`check`,`outline`,`points`],Tt=`reqanalysis.activity`,Et=[`info`,`tool`,`done`,`error`,`stage`];function Dt(e){return`${Tt}.${e}`}function Ot(e){if(!e)return[];let t=l(Dt(e),[]);return Array.isArray(t)?t.filter(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`number`&&typeof t.text==`string`&&typeof t.at==`string`&&typeof(t.detail??``)==`string`&&Et.includes(t.kind)}).slice(-200):[]}var kt=`reqanalysis.run`,At=[`decompose`,`audit`,`fix`,`testpoints`],W=null,jt={current:null},Mt=new Set;function Nt(e){return`${kt}.${e}`}function Pt(e){let t=e?.docId??W?.docId;W=e,t&&a(Nt(t),e);for(let t of Mt)t(e)}function Ft(e){return Mt.add(e),()=>{Mt.delete(e)}}function G(e,t){if(!W||W.status!==`running`)return;let n=Math.max(0,Math.min(100,Math.round(e)));(n!==W.done||t!==void 0&&t!==W.message)&&Pt({...W,total:100,done:n,...t===void 0?{}:{message:t}})}var K=96;function It(e,t=1){if(!W||W.status!==`running`)return;let n=Math.max(1,Math.min(K,Math.round(e))),r=W.done;if(r>=n)return;let i=n-r,a=i>28?Math.min(Math.max(1,t),i):1;Pt({...W,total:100,done:Math.min(n,r+a)})}function Lt(e,t=1200){let n=0,r=window.setInterval(()=>{if(!W||W.status!==`running`)return;let t=Math.max(1,Math.min(K,Math.round(e)))-W.done;t<=0||(n+=1,n%(t>40?1:t>24?2:t>12?3:t>5?5:8)==0&&It(e,1))},t);return()=>window.clearInterval(r)}function Rt(e){if(!e)return null;let t=l(Nt(e),null);if(!t||typeof t!=`object`)return null;let n=t;if(typeof n.label!=`string`||typeof n.message!=`string`||!At.includes(n.kind))return null;let r=n.status===`done`||n.status===`error`?n.status:`stopped`;return{docId:e,kind:n.kind,label:n.label,done:Math.max(0,Number(n.done)||0),total:Math.max(0,Number(n.total)||0),message:n.message,startedAt:Number(n.startedAt)||0,status:r,finishedAt:Number(n.finishedAt)||void 0}}var zt={md:`Markdown`,markdown:`Markdown`,txt:`文本`,csv:`CSV`,docx:`Word`,xlsx:`Excel`,xls:`Excel`,doc:`Word(旧版)`,pdf:`PDF`,ppt:`PPT`,pptx:`PPT`},Bt=`inline-flex h-9 items-center justify-center gap-1.5 rounded-md bg-[#3370ff] px-3.5 text-sm font-medium text-white transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50`,Vt=`inline-flex h-9 items-center justify-center gap-1.5 rounded-md border border-stone-200 bg-white px-3 text-sm text-stone-700 transition-colors hover:bg-stone-50 disabled:cursor-not-allowed disabled:opacity-50`,Ht=`text-xs font-semibold tracking-wide text-stone-500`;function Ut(e){return e.split(`/`).pop()||e}function Wt(e){return(e.format||Ut(e.path).split(`.`).pop()||``).toLowerCase()}function Gt(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return`—`;let n=e=>String(e).padStart(2,`0`),r=`${n(t.getMonth()+1)}/${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`;return t.getFullYear()===new Date().getFullYear()?r:`${t.getFullYear()}/${r}`}function Kt(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return``;let n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function q(e,t=160){if(e==null)return``;let n=``;try{n=typeof e==`string`?e:JSON.stringify(e)}catch{return``}return n?n.length>t?`${n.slice(0,t)}…`:n:``}function qt(e){let t=Math.max(0,(Date.now()-e)/1e3);return t<10?`${t.toFixed(1)}s`:`${Math.round(t)}s`}function Jt(e){return[...e].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))}function Yt({name:e,ready:t}){return(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(f,{text:e,className:`min-w-0 flex-1 truncate text-xs text-stone-500`}),(0,N.jsx)(`span`,{className:`shrink-0 text-[11px] ${t?`text-emerald-600`:`text-stone-400`}`,children:t?`已就绪`:`未就绪`})]})}function Xt(){let e=Ue(`reqAnalysis`),t=Ue(`storyReview`),u=Ue(`testPoints`),[y,re]=(0,E.useState)(null),[x,fe]=(0,E.useState)([]),[S,me]=(0,E.useState)(``),[C,Te]=(0,E.useState)(null),[De,Oe]=(0,E.useState)([]),[je,Ne]=(0,E.useState)(``),[Le,Re]=(0,E.useState)(``),[D,Ke]=(0,E.useState)(null),[O,qe]=(0,E.useState)(null),[k,Je]=(0,E.useState)(null),[A,Ye]=(0,E.useState)(null),[j,Xe]=(0,E.useState)(()=>W);(0,E.useEffect)(()=>(Xe(W),Ft(Xe)),[]);let M=j?.status===`running`?j.kind:null,P=j?.status===`running`&&j.docId===S?{label:j.label,done:j.done,total:j.total,message:j.message}:null,tt=(0,E.useRef)(Date.now()),F=j&&j.docId===S&&j.status!==`running`&&(j.finishedAt??0)<tt.current?j:null,[rt,it]=(0,E.useState)([]),[at,I]=(0,E.useState)(``),[ot,L]=(0,E.useState)(``),[R,z]=(0,E.useState)(()=>o(xt,wt,`stories`));(0,E.useEffect)(()=>{i(xt,R)},[R]);let[ct,lt]=(0,E.useState)(`list`),ut=(0,E.useRef)(o(bt,Ct,`list`)),[B,dt]=(0,E.useState)(!0),[ft,V]=(0,E.useState)(()=>o(yt,[`doc`,`story`],`doc`)),[H,pt]=(0,E.useState)(()=>c(St,``));(0,E.useEffect)(()=>{s(St,H)},[H]);let[U,mt]=(0,E.useState)(null),[ht,gt]=(0,E.useState)([]),Tt=(0,E.useRef)(``),[Et,kt]=(0,E.useState)(``),[At,Mt]=(0,E.useState)([]),K=(0,E.useRef)([]),[Xt,Zt]=(0,E.useState)(!1),[Qt,$t]=(0,E.useState)(!1),J=(0,E.useRef)(null),en=(0,E.useRef)(0),tn=(0,E.useRef)(null),nn=(0,E.useRef)(null),rn=(0,E.useCallback)(e=>t.on||e!==`checked`&&e!==`accepted`?pe[e]:pe.decomposed,[t.on]),an=(0,E.useMemo)(()=>{let e=e=>+!e.supported,t=e=>e.ctime||e.mtime||0;return[...De].filter(e=>!be(e.name)).sort((n,r)=>e(n)-e(r)||t(r)-t(n)||n.path.localeCompare(r.path,`zh`)).map(e=>{let t=Wt(e),n=zt[t]??t.toUpperCase();return{value:e.path,label:e.path,secondary:e.supported?t:`${n} · 暂不支持,请另存为 .docx / .xlsx / .md`,disabled:!e.supported}})},[De]),Y=(0,E.useCallback)(e=>{J.current=e,Te(e),fe(t=>Jt(t.map(t=>t.id===e.id?e:t)))},[]),X=(0,E.useCallback)((e,t=`info`,n)=>{en.current+=1,it(r=>[...r,{id:en.current,kind:t,text:e,detail:n?.trim()||void 0,at:new Date().toISOString()}])},[]),Z=(0,E.useCallback)((e,t,n,r)=>{Pt({docId:J.current?.id??``,kind:e,label:t,done:0,total:100,message:r,startedAt:Date.now(),status:`running`})},[]),on=(0,E.useCallback)(e=>{if(!W||W.status!==`running`)return;let t=e.done==null?W.done:Math.max(0,Math.min(100,Math.round(e.done)));Pt({...W,...e,total:100,done:t})},[]),Q=(0,E.useCallback)((e,t,n)=>{W?.kind===e&&(jt.current=null,Pt({...W,status:t,done:t===`done`?100:W.done,total:100,message:n??W.message,finishedAt:Date.now()}))},[]);(0,E.useEffect)(()=>{S&&Xe(W??Rt(S))},[S]);let sn=(0,E.useCallback)(()=>{S&&a(Nt(S),null),Pt(null)},[S]),cn=(0,E.useRef)(!1);(0,E.useEffect)(()=>{if(!S){cn.current=!0,it([]);return}let e=Ot(S);en.current=e.reduce((e,t)=>Math.max(e,t.id),0),cn.current=!0,it(e)},[S]),(0,E.useEffect)(()=>{cn.current?cn.current=!1:S&&a(Dt(S),rt.slice(-200))},[rt,S]);let ln=(0,E.useCallback)((e,t)=>{let n=K.current,r=n.length===t.length&&n.every((e,n)=>e===t[n]);K.current=t,r||Mt(t),e&&a(`reqanalysis.idealTitles.${e}`,t)},[]),un=(0,E.useCallback)(e=>{if(J.current=e,Te(e),me(e?.id??``),s(vt,e?.id??``),e?.sourcePath&&Ne(e.sourcePath),e?.id){let t=l(`reqanalysis.idealTitles.${e.id}`,[]),n=Array.isArray(t)?t.filter(e=>typeof e==`string`):[];K.current=n,Mt(n)}else K.current=[],Mt([])},[]),dn=(0,E.useCallback)(e=>{lt(e),i(bt,e)},[]),fn=(0,E.useCallback)(async e=>{if(!e?.sourcePath)return ln(``,[]),[];try{let t=await g(e.sourcePath),n=oe(t);return ln(e.id,n),n}catch{return ln(e.id,K.current),K.current}},[ln]),pn=(0,E.useCallback)(async e=>{try{let t=await g(e.sourcePath),n=oe(t);return ln(e.id,n),e}catch{return e}},[ln]),mn=(0,E.useCallback)((e,t=`stories`)=>{un(e),z(t),dn(`work`),Be(`req-analysis`),pn(e)},[dn,un,pn]),hn=(0,E.useCallback)((e,t)=>{Tt.current=t,mn(e,`stories`)},[mn]);(0,E.useEffect)(()=>{if(ct!==`work`||!Tt.current)return;let e=Tt.current;Tt.current=``;let t=0,n=requestAnimationFrame(()=>{let n=document.getElementById(`req-story-${e}`);n&&(n.scrollIntoView({block:`center`,behavior:`smooth`}),n.classList.add(`tw-req-story-focus`),t=window.setTimeout(()=>n.classList.remove(`tw-req-story-focus`),1600))});return()=>{cancelAnimationFrame(n),t&&window.clearTimeout(t)}},[ct,C?.id]);let gn=(0,E.useMemo)(()=>x.flatMap(e=>e.stories.map(t=>({doc:e,story:t}))),[x]),_n=gn.length,vn=(0,E.useMemo)(()=>{let e=H.trim().toLowerCase(),t=t=>String(t??``).toLowerCase().includes(e),n=e?gn.filter(({doc:e,story:n})=>t(n.id)||t(n.title)||t(n.role)||t(n.goal)||t(v(e))||t(e.title)):gn,r=[],i=new Map;for(let e of n){let t=i.get(e.doc.id);t===void 0?(i.set(e.doc.id,r.length),r.push({doc:e.doc,rows:[e]})):r[t].rows.push(e)}return r.sort((e,t)=>t.doc.updatedAt.localeCompare(e.doc.updatedAt))},[gn,H]),yn=(0,E.useMemo)(()=>new Set(U?.ids??[]),[U]),bn=(0,E.useCallback)((e,t)=>{mt(n=>{if(!n||n.docId!==e)return{docId:e,ids:[t]};let r=n.ids.includes(t)?n.ids.filter(e=>e!==t):[...n.ids,t];return r.length?{docId:e,ids:r}:null})},[]),xn=(0,E.useCallback)((e,t)=>{mt(n=>n?.docId===e&&t.every(e=>n.ids.includes(e))?null:t.length?{docId:e,ids:t}:null)},[]),Sn=(0,E.useCallback)(e=>{V(e),i(yt,e)},[]);(0,E.useEffect)(()=>{let e=!0;(async()=>{if(await n(),!e)return;Ke(Ce());let t=await de();if(e){if(re(t),!t)dt(!1);else try{let[t,n,r,i]=await Promise.all([ge(),se(),Ae(),ke()]);if(!e)return;let a=n;if((!n.exists||!n.decompose.trim())&&(await le(!0).catch(()=>void 0),a=await se()),!e)return;qe(a);let o=r;if((!r.exists||!r.review.trim())&&(await Pe(!0).catch(()=>void 0),o=await Ae()),!e)return;o.exists&&Je(o),i.exists&&Ye(i);let s=Jt(t);fe(s);let l=c(vt,``),u=s.find(e=>e.id===l)??s[0]??null;un(u);let d=ut.current;if(ut.current=`list`,d===`work`&&u&&l&&u.id===l&&(dn(`work`),Be(`req-analysis`)),u&&await pn(u),!e)return;dt(!1)}catch(t){e&&(dt(!1),L(t instanceof Error?t.message:String(t)))}}})();let t=Se(()=>Ke(Ce()));return()=>{e=!1,t()}},[dn,un,pn]),(0,E.useEffect)(()=>{if(!t.ready)return;if(!t.on){Je(null),z(e=>e===`check`?`stories`:e);return}if(!y||k!==null)return;let e=!0;return(async()=>{let t=await Ae();(!t.exists||!t.review.trim())&&(await Pe(!0).catch(()=>void 0),t=await Ae()),e&&Je(t)})(),()=>{e=!1}},[t.ready,t.on,y,k]),(0,E.useEffect)(()=>{R===`points`&&C?.sourcePath&&(K.current.length||fn(C))},[R,C,fn]),(0,E.useEffect)(()=>{if(!u.ready)return;if(!u.on){Ye(null),z(e=>e===`points`?`stories`:e);return}if(!y||A!==null)return;let e=!0;return(async()=>{let t=await ke();(!t.exists||!t.generate.trim())&&(await ze(!0).catch(()=>void 0),t=await ke()),e&&Ye(t)})(),()=>{e=!1}},[u.ready,u.on,y,A]),(0,E.useEffect)(()=>{if(!y)return;let e=!0;return ye().then(t=>{e&&Oe(t)}).catch(t=>{e&&Re(t instanceof Error?t.message:String(t))}),()=>{e=!1}},[y]),(0,E.useEffect)(()=>{let e=C?.sourcePath;if(!e){kt(``);return}let t=!0;return g(e).then(e=>{t&&kt(te(e))}).catch(()=>{t&&kt(``)}),()=>{t=!1}},[C?.sourcePath,C?.sourceHash]),(0,E.useEffect)(()=>{let e=tn.current;e&&(e.scrollTop=e.scrollHeight)},[rt]);let Cn=!!(C?.sourceHash&&Et&&C.sourceHash!==Et),wn=(0,E.useMemo)(()=>new Set((C?.stories??[]).flatMap(e=>e.sourceRefs)),[C?.stories]),Tn=O??null,En=!!Tn?.decompose.trim(),Dn=(0,E.useMemo)(()=>(C?.check?.gaps??[]).filter(e=>e.selected).length,[C?.check]),$=(0,E.useCallback)(async(e,t)=>{let n=t??J.current;if(!n)throw Error(`还没有分析文档`);let r=await b(n.id,e);return Y(r),r},[Y]),On=(0,E.useCallback)(()=>{nn.current&&window.clearTimeout(nn.current),nn.current=window.setTimeout(()=>{let e=J.current;e?.check&&b(e.id,{check:e.check}).catch(()=>void 0)},600)},[]),kn=(0,E.useCallback)(async e=>{if(!e)return null;let t=x.find(t=>t.sourcePath===e);if(t)return mn(t,`stories`),t;try{let t=await g(e),n=Ut(e),r=await ue({sourcePath:e,sourceTitle:n,sourceHash:te(t),title:n});return fe(e=>Jt([r,...e])),mn(r,`stories`),X(`新建分析:${v(r)}`),r}catch(e){let t=e instanceof Error?e.message:String(e);return L(t),m(t,`error`),Ne(J.current?.sourcePath??``),null}},[x,mn,X]),An=!!(D?.baseURL&&D.apiKey&&D.model),jn=(0,E.useCallback)(()=>!An||!D?(m(`请先在设置里配置模型`,`error`),we(`model`),null):D,[An,D]),Mn=(0,E.useCallback)((e,t)=>({getDoc:()=>J.current,batch:t,saveOutline:async t=>{let n=await b(e.id,{outline:t});return Y(n),n.outline},saveStories:async t=>{let n=await b(e.id,{stories:t});return Y(n),X(`已写入 ${n.stories.length} 个用户故事`),n},saveCheck:async t=>{let n=J.current?.check,r={...t,gaps:_(n?.gaps??[],t.gaps)},i=await b(e.id,{check:r});return Y(i),i},saveTestPoints:async t=>{let n=await b(e.id,{testPoints:t});return Y(n),n}}),[Y,X]),Nn=(0,E.useCallback)(async()=>{let e=J.current,n=jn();if(!e||!n)return;let r=Tn?.decompose.trim()??``;if(!r){m(`没有读到「${ne}」的「## 拆解」段落`,`error`);return}L(``),I(``),X(`开始拆解`,`stage`),Z(`decompose`,`拆解`,100,`正在读取来源文档`);let i=new AbortController;jt.current=i;let a=`done`;try{let a=await b(e.id,{status:`draft`,progress:{stage:`stories`,done:0,total:100,message:`正在读取来源文档`,at:new Date().toISOString()}});Y(a);let o=await g(e.sourcePath);if(!o.trim())throw Error(`来源文档是空的`);let s=ee(o);if(!s.length)throw Error(`来源文档没有可拆解的内容`);G(5,`共 ${s.length} 批,准备拆第 1 批`),X(s.length>1?`来源 ${o.length} 字,已分 ${s.length} 批拆解`:`来源 ${o.length} 字,单批拆解`);let c=await b(e.id,{replaceStories:!0,stories:[],outline:[],check:null,status:`draft`,sourceHash:te(o)});Y(c);for(let t of s){if(i.signal.aborted)break;let a=J.current?.stories.length??0,o=[r,``,Ge,``,`## 已抽取的需求条目(sourceRefs 只能引用这些 id)`,(J.current?.outline??[]).map(e=>`- ${e.id} ${e.title}${e.quote?`(原文:${e.quote})`:``}`).join(`
19
+ `)||`(本批还没有条目,先调用 req_set_outline)`].join(`
20
+ `),c=[`这一批是原始需求的第 ${t.index+1}/${s.length} 段${t.title?`(章节:${t.title})`:``}。只处理这一段的条目与故事,已完成的部分不要重写。`,``,`## 原始需求`,``,t.text].join(`
21
+ `),l=5+Math.floor(t.index/s.length*85),u=5+Math.floor((t.index+1)/s.length*85),d=t.index===s.length-1,f=Math.max(l+1,d?Math.min(90,u):Math.min(u-2,88));await $({progress:{stage:`stories`,done:l,total:100,message:`正在拆第 ${t.index+1}/${s.length} 批`,at:new Date().toISOString()}},J.current).catch(()=>void 0);let p=Date.now();X(`第 ${t.index+1}/${s.length} 批开始`,`info`,[t.title?`章节:${t.title}`:``,`${t.text.length} 字`].filter(Boolean).join(` · `)),G(l,`正在拆第 ${t.index+1}/${s.length} 批`);let m=Lt(f),h=``;try{for await(let r of xe(n,[{role:`system`,content:o},{role:`user`,content:c}],i.signal,{tools:Ze.filter(e=>[`req_set_outline`,`req_set_stories`].includes(e.function.name)),maxToolRounds:20,runTool:(n,r)=>Qe(n,r,Mn(e,t.index))}))r.type===`content`?(h+=r.delta,I(e=>e+r.delta),It(f,1)):r.type===`tool`&&r.status===`running`?(X(`调用 ${r.name}`,`tool`,q(r.args)),It(f,1)):r.type===`tool`&&r.status===`done`&&(X(`${r.name} 返回`,`tool`,q(r.result,120)),It(f,2))}finally{m()}if(G(Math.min(90,Math.max(f+2,u-2)),`第 ${t.index+1}/${s.length} 批返回,正在写入`),(J.current?.stories.length??0)===a){let n=$e(h);if(n.length){let t=ve(J.current?.stories??[],n),r=await b(e.id,{stories:t});Y(r),X(`模型没调工具,已从回答里兜底解析 ${n.length} 个故事`,`info`)}else X(`第 ${t.index+1} 批没有拿到结构化故事`,`error`)}let g=Math.max(0,(J.current?.stories.length??0)-a);X(`第 ${t.index+1}/${s.length} 批完成`,`done`,`新增 ${g} 个故事 · 耗时 ${qt(p)}`),G(u,`第 ${t.index+1}/${s.length} 批已写入`)}if(i.signal.aborted){X(`已中断:已经写入的故事保留`,`info`);return}G(92,`正在保存拆解结果`);let l=await b(e.id,{status:`decomposed`,progress:{stage:`done`,done:100,total:100,message:`拆解完成`,at:new Date().toISOString()}});Y(l),X(`拆解完成:${l.outline.length} 条需求条目、${l.stories.length} 个用户故事`,`done`),z(`stories`),t.on&&!i.signal.aborted?(G(96,`拆解完成,接着审查`),m(`拆解完成,接着做用户故事审查`,`success`),await Fn.current?.(!0)):(G(100,`拆解完成`),m(`拆解完成`,`success`))}catch(e){let t=e instanceof Error?e.message:String(e);i.signal.aborted?(a=`stopped`,X(`已中断:已经写入的故事保留`,`info`)):(a=`error`,L(t),X(`拆解失败:${t}`,`error`))}finally{i.signal.aborted&&(a=`stopped`),Q(`decompose`,a,a===`done`?`拆解完成`:a===`stopped`?`已中断:已经写入的故事保留`:`拆解失败,详见活动日志`)}},[Z,Q,Mn,Y,X,Tn,jn,on,t.on,$]),Pn=(0,E.useCallback)(async(e=!1)=>{let t=J.current;if(!t)return;if(!t.stories.length){e||m(`还没有用户故事,先做一次拆解`,`info`);return}L(``),e||I(``),X(e?`继续审查用户故事`:`开始审查用户故事`,`stage`,e?`拆解完成后自动接续`:void 0),Z(`audit`,`审查用户故事`,100,`正在跑规则体检`);let n=new AbortController;jt.current=n;let r={status:`done`,message:`审查完成`};try{let e=Date.now();G(8,`正在跑规则体检`);let i=ie(t),a=await b(t.id,{check:{...i,gaps:_(t.check?.gaps??[],i.gaps)},progress:{stage:`audit`,done:18,total:100,message:`规则体检完成,等待模型评审`,at:new Date().toISOString()}});Y(a),X(`规则体检:覆盖率 ${Math.round(i.coverage.rate*100)}%,${i.gaps.length} 个缺口`,`info`,`${t.outline.length} 条需求条目 · ${t.stories.length} 个故事 · 耗时 ${qt(e)}`),G(18,`规则体检完成,等待模型评审`);let o=k?.review.trim()??``,s=An?D:null;if(!s||!o){X(s?`「用户故事审查提示词.md」缺少「## 审查」段落,只保留规则结果`:`没有配置模型,只保留规则结果`,`info`),r.message=`没有配置模型,只保留规则结果`,await b(t.id,{status:`checked`,progress:{stage:`done`,done:100,total:100,message:r.message,at:new Date().toISOString()}}).then(Y).catch(()=>void 0),z(`check`);return}let c=!1,l=Mn(t,90),u=l.saveCheck;l.saveCheck=async e=>{c=!0,G(96,`正在写入审查结果`);let t=await u(e);return X(`模型体检:整体 ${t.check?.gaps.length??0} 个缺口`,`done`),t};let d=J.current??a,f=await _e(d.sourcePath);f.text||X(`没有读到原始需求,只能依据需求条目摘句审查`,`info`),X(`提交模型审查`,`tool`,`模型 ${s.model} · ${d.stories.length} 个故事 · 原文 ${f.text.length} 字`),G(22,`正在提交模型审查`);let p=[`## 原始需求`,f.text?f.truncated?`${f.text}\n\n(原文共 ${f.total} 字,以上为前 ${f.text.length} 字,没看到的部分不要猜)`:f.text:`(未读到原始需求,只能依据下面的需求条目摘句判断)`,``,`## 需求条目`,d.outline.length?d.outline.map(e=>`- ${e.id} ${e.title}${e.quote?`(原文:${e.quote})`:``}`).join(`
22
+ `):`(无)`,``,`## 用户故事(${d.stories.length} 条)`,"```json",JSON.stringify(d.stories,null,2),"```"].join(`
23
+ `),h=Lt(90);try{for await(let e of xe(s,[{role:`system`,content:`${o}\n\n${Ge}`},{role:`user`,content:p}],n.signal,{tools:Ze.filter(e=>e.function.name===`req_save_check`),maxToolRounds:8,runTool:(e,t)=>Qe(e,t,l)}))e.type===`content`?(I(t=>t+e.delta),It(90,1)):e.type===`tool`&&e.status===`running`?(X(`调用 ${e.name}`,`tool`,q(e.args)),G(94,`模型正在提交审查结果`)):e.type===`tool`&&e.status===`done`&&(X(`${e.name} 返回`,`tool`,q(e.result,120)),G(97,`审查结果已返回`))}finally{h()}c||(X(`模型没有提交体检结果,当前只保留规则结果`,`error`),m(`模型没有提交体检结果,只保留了规则检查`,`error`)),G(100,c?`模型评审完成`:`已保留规则结果`),r.message=c?`审查完成`:`模型没提交结果,已保留规则结果`,await b(t.id,{status:`checked`,progress:{stage:`done`,done:100,total:100,message:r.message,at:new Date().toISOString()}}).then(Y).catch(()=>void 0),z(`check`)}catch(e){let t=e instanceof Error?e.message:String(e);n.signal.aborted?(r.status=`stopped`,X(`已中断:规则体检结果已保留`,`info`)):(r.status=`error`,L(t),X(`体检失败:${t}`,`error`))}finally{n.signal.aborted&&(r.status=`stopped`),Q(`audit`,r.status,r.status===`error`?`审查失败,详见活动日志`:r.message)}},[Z,Q,Mn,An,Y,X,on,k,D]),Fn=(0,E.useRef)(null);Fn.current=Pn;let In=(0,E.useCallback)(async()=>{let e=J.current,t=jn();if(!e||!t)return;let n=(e.check?.gaps??[]).filter(e=>e.selected);if(!n.length){m(`先在缺口清单里勾选要补写的条目`,`info`);return}let r=k?.fix.trim()??``;if(!r){m(`「用户故事审查提示词.md」缺少「## 补写」段落`,`error`);return}L(``),I(``),X(`开始补写选中条目`,`stage`,`勾选 ${n.length} 个缺口`),Z(`fix`,`补写选中条目`,100,`正在按 ${n.length} 个勾选缺口补写`);let i=Date.now(),a=new AbortController;jt.current=a;let o={status:`done`,message:`补写完成`};try{G(5,`正在按 ${n.length} 个勾选缺口补写`),X(`按 ${n.length} 个勾选缺口补写`,`info`,n.map(e=>`[${e.severity}] ${e.storyId||`全局`}|${e.title}`).join(`;`));let s=new Map(e.stories.map(e=>[e.id,e.title])),c=await _e(e.sourcePath),l=[`## 原始需求`,c.text?c.truncated?`${c.text}\n\n(原文共 ${c.total} 字,以上为前 ${c.text.length} 字,没看到的部分不要猜)`:c.text:`(未读到原始需求,只能依据需求条目与当前故事集判断)`,``,`## 需求条目(新增故事的 sourceRefs 只能引用这里的 id)`,e.outline.length?e.outline.map(e=>`- ${e.id} ${e.title}${e.quote?`(原文:${e.quote})`:``}`).join(`
24
+ `):`(无)`,``,`## 当前故事集(${e.stories.length} 条,没被点名的必须原样保留)`,"```json",JSON.stringify(e.stories,null,2),"```",``,`## 勾选待补写的缺口`,n.map(e=>{let t=e.storyId?`${e.storyId} ${s.get(e.storyId)??``}`:`全局问题`;return[`- [${e.severity}] ${t}|${e.title}`,e.detail?` 原因:${e.detail}`:``,e.suggestion?` 建议:${e.suggestion}`:``].filter(Boolean).join(`
25
+ `)}).join(`
26
+ `)].join(`
27
+ `),u=Mn(e,90),d=!1,f=u.saveStories;u.saveStories=async e=>(d=!0,G(90,`正在写入补写结果`),f(e)),G(12,`正在提交模型补写`);let p=Lt(88);try{for await(let e of xe(t,[{role:`system`,content:`${r}\n\n${Ge}`},{role:`user`,content:l}],a.signal,{tools:Ze.filter(e=>e.function.name===`req_set_stories`),maxToolRounds:10,runTool:(e,t)=>Qe(e,t,u)}))e.type===`content`?(I(t=>t+e.delta),It(88,1)):e.type===`tool`&&e.status===`running`?(X(`调用 ${e.name}`,`tool`,q(e.args)),G(90,`模型正在提交补写`)):e.type===`tool`&&e.status===`done`&&(X(`${e.name} 返回`,`tool`,q(e.result,120)),G(94,`补写结果已返回`))}finally{p()}if(!d){o.status=`error`,o.message=`模型没有提交补写结果,故事集保持不变`,X(`模型没有提交补写结果,故事集保持不变`,`error`),m(`模型没有提交补写结果`,`error`);return}G(94,`已写入补写结果,正在重算覆盖率`);let h=J.current;if(h){let e=ie(h),t=await b(h.id,{check:e,status:`decomposed`});Y(t)}let g=Math.round((J.current?.check?.coverage.rate??0)*100);X(`补写完成,已按规则重算覆盖率;建议再跑一次体检`,`done`,`覆盖率 ${g}% · 耗时 ${qt(i)}`),await $({progress:{stage:`done`,done:100,total:100,message:`补写完成`,at:new Date().toISOString()}},J.current).catch(()=>void 0),z(`check`),m(`补写完成,建议再跑一次体检`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);a.signal.aborted?(o.status=`stopped`,X(`已中断:已经写入的改动保留`,`info`)):(o.status=`error`,o.message=t,L(t),X(`补写失败:${t}`,`error`))}finally{a.signal.aborted&&(o.status=`stopped`),Q(`fix`,o.status,o.status===`error`?`补写失败:${o.message}`:o.message)}},[Z,Q,Mn,Y,X,on,jn,k,$]),Ln=(0,E.useCallback)(async()=>{let e=J.current,t=jn();if(!e||!t)return;if(!e.stories.length){m(`还没有用户故事,先做一次拆解`,`info`);return}let n=A?.generate.trim()??``;if(!n){m(`没有读到「${Ee}」的「## 生成」段落`,`error`);return}L(``),I(``),X(`开始生成测试点`,`stage`,`基于 ${e.stories.length} 个用户故事,五维覆盖 P0–P3`),Z(`testpoints`,`生成测试点`,100,`正在整理用户故事,等待模型生成`),z(`points`),await $({progress:{stage:`points`,done:5,total:100,message:`正在生成测试点`,at:new Date().toISOString()}},e).catch(()=>void 0);let r=Date.now();G(8,`正在整理用户故事`),X(`整理用户故事,提交模型生成`,`info`,`${e.outline.length} 条需求条目 · ${e.stories.length} 个故事 · 模型 ${t.model}`);let i=new AbortController;jt.current=i;let a={status:`done`,message:`测试点已生成`};try{let o=Mn(e,90),s=!1,c=o.saveTestPoints;o.saveTestPoints=async e=>{s=!0,G(90,`正在写入测试点`);let t=await c(e);return X(`测试点已写入:${t.testPoints?.points.length??0} 条`,`done`),t};let l=[`## 分析标题\n${e.title||`未命名分析`}`,``,`## 需求条目`,e.outline.length?e.outline.map(e=>`- ${e.id} ${e.title}${e.quote?`(原文:${e.quote})`:``}`).join(`
28
+ `):`(无)`,``,`## 用户故事(${e.stories.length} 条)`,"```json",JSON.stringify(e.stories,null,2),"```"].join(`
29
+ `);G(15,`正在提交模型生成`);let u=``,d=Lt(88);try{for await(let e of xe(t,[{role:`system`,content:`${n}\n\n${Ge}`},{role:`user`,content:l}],i.signal,{tools:Ze.filter(e=>e.function.name===`req_save_test_points`),maxToolRounds:8,runTool:(e,t)=>Qe(e,t,o)}))e.type===`content`?(u+=e.delta,I(t=>t+e.delta),It(88,1)):e.type===`tool`&&e.status===`running`?(X(`调用 ${e.name}`,`tool`,q(e.args)),G(90,`模型正在提交测试点`)):e.type===`tool`&&e.status===`done`&&(X(`${e.name} 返回`,`tool`,q(e.result,120)),G(94,`测试点已返回`))}finally{d()}if(!s){let t=et(u,e.stories.map(e=>e.id));t&&(await o.saveTestPoints(t),s=!0,X(`模型没调工具,已从回答里兜底解析 ${t.points.length} 条`,`info`))}if(!s)a.status=`error`,a.message=`模型没有提交测试点,原结果保持不变`,X(`模型没有提交测试点,原结果保持不变`,`error`),m(`模型没有提交测试点,原结果保持不变`,`error`);else{let e=J.current?.testPoints?.points??[],t=t=>e.filter(e=>e.priority===t).length;X(`测试点完成:${e.length} 条`,`done`,`P0 ${t(`P0`)} / P1 ${t(`P1`)} / P2 ${t(`P2`)} / P3 ${t(`P3`)} · 耗时 ${qt(r)}`),G(100,`已生成 ${e.length} 条`),a.message=`测试点已生成 ${e.length} 条`,await $({progress:{stage:`done`,done:100,total:100,message:`测试点已生成 ${e.length} 条`,at:new Date().toISOString()}},J.current).catch(()=>void 0),m(`测试点已生成`,`success`)}}catch(e){let t=e instanceof Error?e.message:String(e);i.signal.aborted?(a.status=`stopped`,X(`已中断:已经生成的测试点保留`,`info`)):(a.status=`error`,a.message=t,L(t),X(`生成测试点失败:${t}`,`error`))}finally{i.signal.aborted&&(a.status=`stopped`),Q(`testpoints`,a.status,a.status===`error`?`生成测试点失败:${a.message}`:a.message)}},[Z,Q,Mn,X,on,jn,$,A]),Rn=(0,E.useCallback)(async()=>{let e=J.current;if(!e?.testPoints)m(`还没有测试点可导出`,`info`);else try{let t=K.current;t.length||(t=await fn(e));let n=await Me(e,t);X(`已导出 ${n}`,`done`)}catch(e){m(`导出失败:${e instanceof Error?e.message:String(e)}`,`error`)}},[X,fn]),zn=(0,E.useCallback)(async()=>{let e=J.current;if(!e?.testPoints){m(`还没有测试点可导出`,`info`);return}let t=K.current;t.length||(t=await fn(e));let n=Fe(e,t);X(`已导出 ${n}`,`done`)},[X,fn]),Bn=(0,E.useCallback)(async e=>{let t=J.current;if(t)try{await $({stories:e},t)}catch(e){m(`保存失败:${e instanceof Error?e.message:String(e)}`,`error`)}},[$]),Vn=(0,E.useCallback)((e,t)=>{let n=J.current;if(!n)return;let r=n.stories.map((n,r)=>r===e?{...t,id:n.id}:n);Bn(r)},[Bn]),Hn=(0,E.useCallback)(e=>{let t=J.current;t&&Bn(t.stories.filter((t,n)=>n!==e))},[Bn]),Un=(0,E.useCallback)((e,t)=>{let n=J.current;if(!n)return;let r=e+t;if(r<0||r>=n.stories.length)return;let i=[...n.stories],a=i[e],o=i[r];a&&o&&(i[e]=o,i[r]=a,Bn(i))},[Bn]),Wn=(0,E.useCallback)((e,t)=>{let n=J.current;if(!n?.check)return;let r={...n,check:{...n.check,gaps:n.check.gaps.map(n=>n.id===e?{...n,selected:t}:n)}};Y(r),On()},[Y,On]),Gn=(0,E.useCallback)(e=>{let t=J.current;if(!t?.check)return;let n={...t,check:{...t.check,gaps:t.check.gaps.map(t=>({...t,selected:e}))}};Y(n),On()},[Y,On]),Kn=(0,E.useCallback)(async()=>{let e=J.current;if(e)try{await he(e.id);let t=x.filter(t=>t.id!==e.id);fe(t),un(t[0]??null),dn(`list`),m(`已删除分析记录`,`success`)}catch(e){m(`删除失败:${e instanceof Error?e.message:String(e)}`,`error`)}finally{Zt(!1)}},[dn,x,un]),qn=(0,E.useCallback)(()=>{let e=J.current;if(!e)return;let t=new Blob([h(e)],{type:`text/markdown;charset=utf-8`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=ae(e),document.body.appendChild(r),r.click(),r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3),m(`已导出 Markdown`,`success`)},[]),Jn=(0,E.useCallback)(()=>{let e=J.current;if(!e?.check)return;let t=Ie(e,e.check);m(`已导出 ${t}`,`success`)},[]),Yn=(0,E.useCallback)(()=>{jt.current?.abort()},[]);if(!e.ready)return(0,N.jsx)(He,{label:`正在读取插件开关`});if(!e.on)return(0,N.jsx)(Ve,{children:r(`reqAnalysis`)});if(y===null)return(0,N.jsx)(He,{label:`正在连接需求分析服务`});if(!y)return(0,N.jsx)(Ve,{children:"需求分析需要本地服务,当前未就绪:确认服务已升级到最新版本并重启(`lantern` 一体服务或 `npm run dev`),静态部署的页面用不了。"});if(B)return(0,N.jsx)(He,{label:`正在回到上次的分析`});let Xn=C?.outline.filter(e=>wn.has(e.id)).length??0,Zn=C?.check?.gaps??[],Qn=(0,N.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[(0,N.jsxs)(`section`,{className:`shrink-0 rounded-xl border border-stone-200 bg-white px-4 py-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,N.jsxs)(`div`,{className:`min-w-[240px] flex-1`,children:[(0,N.jsx)(`p`,{className:Ht,children:`新建分析`}),(0,N.jsx)(`div`,{className:`mt-1.5 max-w-[440px]`,children:(0,N.jsx)(p,{options:an,value:je,onChange:e=>{Ne(e),e&&kn(e)},triggerTitle:je||`选择来源需求文档…`,ariaLabel:`选择来源需求文档`,searchable:!0,searchPlaceholder:`搜索文件名或路径…`,flat:!0})})]}),(0,N.jsxs)(`span`,{className:`pb-1 text-[11px] text-stone-400`,children:[`共 `,x.length,` 份分析`]})]}),Le?(0,N.jsxs)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-700`,children:[`读不到需求文档库:`,Le,(0,N.jsx)(`br`,{}),`请先启用「需求文档库」插件,或确认 `,ce,` 之外的内容目录没有被移动。`]}):null]}),ot?(0,N.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700`,children:[(0,N.jsx)(`span`,{className:`break-all`,children:ot}),(0,N.jsx)(`button`,{type:`button`,className:`shrink-0 text-red-400`,onClick:()=>L(``),children:`✕`})]}):null,(0,N.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,N.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-stone-100 px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`inline-flex rounded-lg border border-stone-200 bg-stone-50 p-0.5`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>Sn(`doc`),className:`h-7 rounded-md px-2.5 text-xs transition-colors ${ft===`doc`?`bg-white text-stone-900 shadow-sm`:`text-stone-500 hover:text-stone-700`}`,children:`按需求说明书`}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>Sn(`story`),className:`h-7 rounded-md px-2.5 text-xs transition-colors ${ft===`story`?`bg-white text-stone-900 shadow-sm`:`text-stone-500 hover:text-stone-700`}`,children:`按用户故事`})]}),ft===`story`?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`label`,{className:`relative block`,children:[(0,N.jsx)(T,{name:`search`,size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-stone-400`}),(0,N.jsx)(`input`,{value:H,onChange:e=>pt(e.target.value),placeholder:`搜索编号 / 标题 / 角色…`,className:`h-8 w-52 rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-xs text-stone-800 outline-none transition-colors focus:border-[#3370ff]`})]}),(0,N.jsxs)(`span`,{className:`text-[11px] text-stone-400`,children:[_n,` 个故事`,U?` · 已选 ${U.ids.length}`:``]}),(0,N.jsx)(`button`,{type:`button`,disabled:!U,onClick:()=>{if(!U)return;let e=new URLSearchParams({plugin:`caseGen`,reqDoc:U.docId,stories:U.ids.join(`,`)});window.location.href=`/workbench/?${e.toString()}`},className:`${Bt} ml-auto h-8 text-xs`,children:`用选中故事生成用例`})]}):(0,N.jsxs)(`span`,{className:`ml-auto text-[11px] text-stone-400`,children:[x.length,` 份分析 · `,_n,` 个故事`]})]}),(0,N.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:ft===`doc`?x.length?(0,N.jsx)(`ul`,{className:`divide-y divide-stone-100`,children:x.map(e=>{let t=rn(e.status);return(0,N.jsxs)(`li`,{className:`flex items-center gap-3 px-4 py-3 transition-colors hover:bg-stone-50`,children:[(0,N.jsx)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center text-left`,onClick:()=>mn(e,`stories`),children:(0,N.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,N.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`truncate text-sm font-medium text-stone-800`,children:v(e)}),(0,N.jsx)(w,{tone:t.tone,children:t.label})]}),(0,N.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px] text-stone-400`,children:[(0,N.jsx)(`span`,{className:`truncate`,children:e.sourcePath||`(未指定来源)`}),(0,N.jsxs)(`span`,{children:[`用户故事 `,e.stories.length]}),(0,N.jsxs)(`span`,{children:[`需求条目 `,e.outline.length]}),(0,N.jsx)(`span`,{children:Gt(e.updatedAt)})]})]})}),(0,N.jsxs)(`button`,{type:`button`,className:`inline-flex h-8 shrink-0 items-center gap-1 rounded-md border border-stone-200 bg-white px-2.5 text-xs text-stone-700 transition-colors hover:border-[#3370ff] hover:text-[#3370ff]`,onClick:()=>mn(e,`stories`),children:[`用户故事`,(0,N.jsx)(T,{name:`chevronRight`,size:13})]}),(0,N.jsx)(`button`,{type:`button`,"aria-label":`删除 ${v(e)}`,className:`tw-icon-danger flex h-8 w-8 shrink-0 items-center justify-center rounded-md`,onClick:()=>{un(e),Zt(!0)},children:(0,N.jsx)(T,{name:`trash`,size:14})})]},e.id)})}):(0,N.jsx)(We,{icon:`file`,title:`还没有分析记录`,hint:`上面选一份需求文档,系统会新建一份分析并进入用户故事拆解。`}):vn.length?(0,N.jsx)(`div`,{className:`divide-y divide-stone-100`,children:vn.map(({doc:e,rows:t})=>{let n=ht.includes(e.id),r=t.map(e=>e.story.id),i=U?.docId===e.id&&r.length>0&&r.every(e=>yn.has(e));return(0,N.jsxs)(`section`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 bg-stone-50/70 px-3 py-1.5`,children:[(0,N.jsx)(`input`,{type:`checkbox`,"aria-label":`选中 ${v(e)} 的全部故事`,checked:i,onChange:()=>xn(e.id,r)}),(0,N.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left`,onClick:()=>gt(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id]),children:[(0,N.jsx)(T,{name:n?`chevronRight`:`chevronDown`,size:13,className:`shrink-0 text-stone-400`}),(0,N.jsx)(`span`,{className:`truncate text-xs font-medium text-stone-700`,children:v(e)}),(0,N.jsxs)(`span`,{className:`shrink-0 text-[11px] text-stone-400`,children:[t.length,` 个故事 · `,Gt(e.updatedAt)]})]}),(0,N.jsx)(`button`,{type:`button`,className:`shrink-0 text-[11px] text-[#3370ff] hover:underline`,onClick:()=>mn(e,`stories`),children:`打开拆解`})]}),n?null:(0,N.jsx)(`ul`,{className:`divide-y divide-stone-50`,children:t.map(({story:t})=>(0,N.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2 transition-colors hover:bg-stone-50`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`mt-1`,"aria-label":`选中 ${t.id}`,checked:yn.has(t.id)&&U?.docId===e.id,onChange:()=>bn(e.id,t.id)}),(0,N.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left`,onClick:()=>hn(e,t.id),children:[(0,N.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-stone-400`,children:t.id}),(0,N.jsx)(`span`,{className:`truncate text-sm text-stone-800`,children:t.title})]}),(0,N.jsxs)(`span`,{className:`mt-0.5 flex flex-wrap items-center gap-x-2.5 gap-y-0.5 text-[11px] text-stone-400`,children:[t.role?(0,N.jsxs)(`span`,{children:[`角色:`,t.role]}):null,(0,N.jsxs)(`span`,{children:[`优先级 `,t.priority]}),(0,N.jsxs)(`span`,{children:[`验收 `,t.acceptance.length]}),(0,N.jsxs)(`span`,{children:[`异常 `,t.exceptions.length]}),(0,N.jsxs)(`span`,{children:[`维度 `,t.dimensions.length]})]})]})]},`${e.id}-${t.id}`))})]},e.id)})}):(0,N.jsx)(We,{icon:`file`,title:H?`没有匹配的用户故事`:`还没有用户故事`,hint:H?`换个编号、标题或角色再试。`:`先按「需求说明书」选中一份文档拆解,故事会自动出现在这里。`})})]})]});return(0,N.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col p-3`,children:[ct===`list`?Qn:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`div`,{className:`mb-2 flex shrink-0 items-center gap-2`,children:[(0,N.jsxs)(`button`,{type:`button`,className:`inline-flex h-8 items-center gap-1 rounded-md border border-stone-200 bg-white px-2.5 text-xs text-stone-600 transition-colors hover:border-stone-300 hover:text-stone-800`,onClick:()=>{Ne(``),L(``),dn(`list`)},children:[(0,N.jsx)(T,{name:`arrowLeft`,size:14}),`返回列表`]}),(0,N.jsx)(`span`,{className:`min-w-0 truncate text-xs text-stone-400`,children:C?`用户故事 · ${v(C)}`:`用户故事`})]}),(0,N.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-4`,children:[(0,N.jsxs)(`aside`,{className:`flex w-[280px] shrink-0 flex-col gap-3 overflow-y-auto pb-1`,children:[(0,N.jsxs)(`section`,{"data-hint-width":!0,className:`rounded-xl border border-stone-200 bg-white`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between border-b border-stone-100 px-3.5 py-2.5`,children:[(0,N.jsx)(`p`,{className:Ht,children:`分析记录`}),(0,N.jsx)(`span`,{className:`text-[11px] tabular-nums text-stone-400`,children:x.length})]}),(0,N.jsx)(`div`,{className:`px-2 py-2`,children:x.length?(0,N.jsx)(`ul`,{className:`space-y-0.5`,children:x.map(e=>{let t=e.id===S,n=rn(e.status);return(0,N.jsx)(`li`,{children:(0,N.jsx)(`button`,{type:`button`,className:`flex w-full items-start gap-2 rounded-lg px-2 py-1.5 text-left transition-colors ${t?`bg-[#eef3ff]`:`hover:bg-stone-50`}`,onClick:()=>un(e),children:(0,N.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,N.jsx)(f,{text:v(e),matchAnchorWidth:!0,className:`block truncate text-xs ${t?`font-medium text-[#1f4fd8]`:`text-stone-700`}`}),(0,N.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-1 text-[11px] text-stone-400`,children:[(0,N.jsx)(w,{tone:n.tone,children:n.label}),(0,N.jsxs)(`span`,{children:[e.stories.length,` 个故事`]})]})]})})},e.id)})}):(0,N.jsx)(`p`,{className:`px-1.5 py-1 text-xs text-stone-400`,children:`还没有分析记录,选一份来源文档开始。`})})]}),(0,N.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white`,children:[(0,N.jsx)(`div`,{className:`border-b border-stone-100 px-3.5 py-2.5`,children:(0,N.jsx)(`p`,{className:Ht,children:`提示词`})}),(0,N.jsxs)(`div`,{className:`px-3.5 py-3`,children:[(0,N.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,N.jsx)(Yt,{name:ne,ready:En}),(0,N.jsx)(Yt,{name:k?.file??`用户故事审查提示词.md`,ready:t.on&&!!k?.review.trim()&&!!k?.fix.trim()}),(0,N.jsx)(Yt,{name:Ee,ready:u.on&&!!A?.generate.trim()})]}),(0,N.jsx)(`p`,{className:`mt-2 text-[11px] ${An?`text-stone-400`:`text-amber-700`}`,children:An?`模型:${D?.model}`:`还没配置模型`})]})]}),(0,N.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white`,children:[(0,N.jsx)(`div`,{className:`border-b border-stone-100 px-3.5 py-2.5`,children:(0,N.jsx)(`p`,{className:Ht,children:`动作`})}),(0,N.jsxs)(`div`,{className:`space-y-2 px-3.5 py-3`,children:[(0,N.jsx)(`button`,{type:`button`,className:`${Bt} w-full`,disabled:!C||!!M||!C.sourcePath,onClick:()=>{C?.stories.length?$t(!0):Nn()},children:M===`decompose`?`拆解中…`:C?.stories.length?`重新拆解`:`开始拆解`}),t.on?(0,N.jsx)(`button`,{type:`button`,className:`${Vt} w-full`,disabled:!C||!!M||!C.stories.length,onClick:()=>void Pn(),children:M===`audit`?`审查中…`:C?.check?`重新审查用户故事`:`用户故事审查`}):null,u.on?(0,N.jsx)(`button`,{type:`button`,className:`${Vt} w-full`,disabled:!C||!!M||!C.stories.length,onClick:()=>void Ln(),children:M===`testpoints`?`生成中…`:C?.testPoints?`重新生成测试点`:`生成测试点`}):null,M?(0,N.jsx)(`button`,{type:`button`,className:`${Vt} w-full`,onClick:Yn,children:`中断`}):(0,N.jsx)(`button`,{type:`button`,className:`${Vt} w-full`,disabled:!C,onClick:qn,children:`导出 Markdown`}),C&&!M?(0,N.jsx)(`button`,{type:`button`,className:`h-8 w-full rounded-md text-xs text-stone-400 transition-colors hover:bg-red-50 hover:text-red-500`,onClick:()=>Zt(!0),children:`删除这份分析`}):null]})]}),(0,N.jsxs)(`section`,{className:`flex min-h-[140px] flex-1 flex-col rounded-xl border border-stone-200 bg-white`,children:[(0,N.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-stone-100 px-3.5 py-2.5`,children:[(0,N.jsx)(`p`,{className:Ht,children:`活动日志`}),rt.length?(0,N.jsx)(`button`,{type:`button`,className:`text-[11px] text-stone-400 transition-colors hover:text-stone-600`,onClick:()=>it([]),children:`清空`}):null]}),(0,N.jsx)(`div`,{ref:tn,className:`min-h-0 flex-1 space-y-1 overflow-y-auto px-3.5 py-2.5`,children:rt.length?rt.map(e=>e.kind===`stage`?(0,N.jsxs)(`div`,{className:`flex items-center gap-2 pt-1.5 first:pt-0`,children:[(0,N.jsx)(`span`,{className:`h-px flex-1 bg-stone-200`,"aria-hidden":`true`}),(0,N.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium text-stone-500`,children:e.text}),(0,N.jsx)(`span`,{className:`shrink-0 text-[10px] tabular-nums text-stone-300`,children:Kt(e.at)}),(0,N.jsx)(`span`,{className:`h-px flex-1 bg-stone-200`,"aria-hidden":`true`})]},e.id):(0,N.jsxs)(`div`,{className:`flex gap-1.5 text-[11px] leading-relaxed`,children:[(0,N.jsx)(`span`,{className:`mt-px shrink-0 text-[10px] tabular-nums text-stone-300`,children:Kt(e.at)}),(0,N.jsx)(`span`,{className:`mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full ${e.kind===`error`?`bg-red-500`:e.kind===`done`?`bg-emerald-500`:e.kind===`tool`?`bg-[#3370ff]`:`bg-stone-300`}`,"aria-hidden":`true`}),(0,N.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,N.jsx)(`span`,{className:e.kind===`error`?`text-red-600`:e.kind===`done`?`text-stone-700`:`text-stone-500`,children:e.text}),e.detail?(0,N.jsx)(`span`,{className:`mt-0.5 block break-all text-[10px] leading-relaxed text-stone-400`,children:e.detail}):null]})]},e.id)):(0,N.jsx)(`p`,{className:`text-[11px] leading-relaxed text-stone-400`,children:`拆解 / 审查的过程会记在这里:抽取需求条目、写故事、跑审查与补写。`})})]})]}),(0,N.jsxs)(`section`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[ot?(0,N.jsxs)(`div`,{className:`mb-2 flex items-start justify-between gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700`,children:[(0,N.jsx)(`span`,{className:`break-all`,children:ot}),(0,N.jsx)(`button`,{type:`button`,className:`shrink-0 text-red-400`,onClick:()=>L(``),children:`✕`})]}):null,F&&!M?(0,N.jsxs)(`div`,{className:`mb-2 flex items-start justify-between gap-2 rounded-lg border px-3 py-2 text-xs ${F.status===`done`?`border-emerald-200 bg-emerald-50 text-emerald-700`:F.status===`error`?`border-red-200 bg-red-50 text-red-700`:`border-amber-200 bg-amber-50 text-amber-700`}`,children:[(0,N.jsxs)(`span`,{className:`break-all`,children:[(0,N.jsxs)(`span`,{className:`font-medium`,children:[F.label,F.status===`done`?`已完成`:F.status===`error`?`失败`:`已中断`]}),(0,N.jsx)(`span`,{className:`ml-1.5 opacity-80`,children:F.message}),F.finishedAt?(0,N.jsxs)(`span`,{className:`ml-1.5 opacity-60`,children:[`· `,Gt(new Date(F.finishedAt).toISOString())]}):null]}),(0,N.jsx)(`button`,{type:`button`,className:`shrink-0 opacity-60 transition-opacity hover:opacity-100`,"aria-label":`关闭上次任务提示`,onClick:sn,children:`✕`})]}):null,C?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`header`,{className:`shrink-0 rounded-xl border border-stone-200 bg-white`,children:[(0,N.jsxs)(`div`,{className:`px-4 pt-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(f,{text:v(C),matchAnchorWidth:!0,className:`min-w-0 flex-1 truncate px-1 py-0.5 text-[15px] font-semibold text-stone-800`}),M?(0,N.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1.5 text-xs text-stone-500`,children:[(0,N.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`}),P?P.message:M===`decompose`?`拆解中`:M===`audit`?`审查中`:M===`testpoints`?`生成测试点中`:M===`fix`?`补写中`:`处理中`,P&&P.total>0?(0,N.jsxs)(`span`,{className:`tabular-nums text-stone-400`,children:[Math.round(Math.min(P.done,P.total)/P.total*100),`%`]}):null]}):null,(0,N.jsx)(w,{tone:rn(C.status).tone,children:rn(C.status).label})]}),M?(0,N.jsx)(`div`,{className:`mt-2`,children:(0,N.jsx)(`div`,{className:`tw-run-track`,role:`progressbar`,"aria-label":`${P?.label??`任务`}进度`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":P&&P.total>0?Math.round(Math.min(P.done,P.total)/P.total*100):void 0,children:(0,N.jsx)(`div`,{className:P&&P.total>0?`tw-run-fill`:`tw-run-fill tw-run-fill--indeterminate`,style:P&&P.total>0?{width:`${Math.round(Math.min(P.done,P.total)/P.total*100)}%`}:void 0})})}):null,(0,N.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center gap-2.5 text-[11px] text-stone-400`,children:[(0,N.jsxs)(`span`,{className:`shrink-0`,children:[`故事`,` `,(0,N.jsx)(`span`,{className:`font-medium text-stone-600`,children:C.stories.length})]}),(0,N.jsx)(`span`,{className:`h-3 w-px shrink-0 bg-stone-200`,"aria-hidden":`true`}),(0,N.jsxs)(`span`,{className:`shrink-0`,children:[`条目`,` `,(0,N.jsxs)(`span`,{className:`font-medium text-stone-600`,children:[Xn,`/`,C.outline.length]}),` `,`覆盖`]}),t.on?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`span`,{className:`h-3 w-px shrink-0 bg-stone-200`,"aria-hidden":`true`}),(0,N.jsxs)(`span`,{className:`shrink-0`,children:[`缺口`,` `,(0,N.jsx)(`span`,{className:`font-medium text-stone-600`,children:Zn.length}),Dn?` · 已选 ${Dn}`:``]}),C.check?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`span`,{className:`h-3 w-px shrink-0 bg-stone-200`,"aria-hidden":`true`}),(0,N.jsxs)(`span`,{className:`shrink-0`,children:[`覆盖率`,` `,(0,N.jsx)(`span`,{className:`font-medium text-stone-600`,children:C.check.coverage.total?`${Math.round(C.check.coverage.rate*100)}%`:`—`})]})]}):null]}):null,u.on?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`span`,{className:`h-3 w-px shrink-0 bg-stone-200`,"aria-hidden":`true`}),(0,N.jsxs)(`span`,{className:`shrink-0`,children:[`测试点`,` `,(0,N.jsx)(`span`,{className:`font-medium text-stone-600`,children:C.testPoints?.points.length??0})]})]}):null,(0,N.jsxs)(`span`,{className:`ml-auto min-w-0 truncate pl-2`,children:[`来源:`,C.sourcePath]}),Cn?(0,N.jsx)(`span`,{className:`shrink-0 rounded bg-amber-50 px-1.5 py-0.5 text-[10px] text-amber-700`,children:`源文档已更新`}):null]})]}),(0,N.jsx)(`div`,{role:`tablist`,"aria-label":`需求分析视图`,className:`mt-2.5 flex items-center gap-1 border-b border-stone-100 px-2`,children:[{id:`stories`,label:`用户故事`,count:C.stories.length},{id:`check`,label:`审查结果`,count:Zn.length},{id:`outline`,label:`需求条目`,count:C.outline.length},{id:`points`,label:`测试点`,count:C.testPoints?.points.length??0}].filter(e=>(e.id!==`check`||t.on)&&(e.id!==`points`||u.on)).map(e=>{let t=R===e.id;return(0,N.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t,className:`-mb-px flex items-center gap-1.5 border-b-2 px-3 py-2 text-xs transition-colors ${t?`border-[#3370ff] font-medium text-[#3370ff]`:`border-transparent text-stone-500 hover:text-stone-800`}`,onClick:()=>z(e.id),children:[e.label,(0,N.jsx)(`span`,{className:`rounded-full px-1.5 text-[10px] leading-4 tabular-nums ${t?`bg-[#eaf1ff] text-[#3370ff]`:`bg-stone-100 text-stone-400`}`,children:e.count})]},e.id)})})]}),(0,N.jsxs)(`div`,{className:`mt-3 min-h-0 flex-1 overflow-y-auto pr-1`,children:[R===`stories`?C.stories.length?(0,N.jsx)(`ul`,{className:`space-y-2`,children:C.stories.map((e,t)=>(0,N.jsx)(_t,{story:e,index:t,total:C.stories.length,gaps:Zn.filter(t=>t.storyId===e.id),busy:!!M,onSave:e=>Vn(t,e),onDelete:()=>Hn(t),onMove:e=>Un(t,e),domId:e.id?`req-story-${e.id}`:void 0},`${e.id}-${t}`))}):(0,N.jsx)(`div`,{className:`flex items-center justify-center rounded-xl border border-stone-200 bg-white`,children:(0,N.jsx)(We,{icon:`file`,title:`还没有用户故事`,hint:`点左侧「开始拆解」,会先抽需求条目再拆故事。`})}):null,R===`check`&&t.on?(0,N.jsx)(nt,{check:C.check,stories:C.stories,busy:!!M,onToggleGap:Wn,onToggleAll:Gn,onFix:()=>void In(),onReview:()=>void Pn(),onExport:Jn}):null,R===`points`&&u.on?(0,N.jsx)(st,{doc:C,idealTitles:At,generating:M===`testpoints`,busy:!!M,promptReady:!!A?.generate.trim(),onExportXmind:()=>void Rn(),onExportMarkdown:()=>void zn()}):null,R===`outline`?C.outline.length?(0,N.jsx)(`ul`,{className:`space-y-2`,children:C.outline.map(e=>{let t=wn.has(e.id);return(0,N.jsx)(`li`,{className:`rounded-xl border border-stone-200 bg-white px-4 py-2.5`,children:(0,N.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,N.jsx)(`span`,{className:`mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full ${t?`bg-emerald-500`:`bg-amber-400`}`,"aria-hidden":`true`}),(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsxs)(`p`,{className:`text-sm text-stone-800`,children:[(0,N.jsx)(`span`,{className:`mr-1.5 rounded bg-stone-100 px-1.5 py-0.5 font-mono text-[11px] text-stone-500`,children:e.id}),e.title]}),e.quote?(0,N.jsx)(`p`,{className:`mt-1 border-l-2 border-stone-200 pl-2 text-xs leading-relaxed text-stone-400`,children:e.quote}):null]}),(0,N.jsx)(`span`,{className:`shrink-0 text-[11px] ${t?`text-emerald-600`:`text-amber-600`}`,children:t?`已覆盖`:`未覆盖`})]})},e.id)})}):(0,N.jsx)(`div`,{className:`flex items-center justify-center rounded-xl border border-stone-200 bg-white`,children:(0,N.jsx)(We,{icon:`file`,title:`还没有需求条目`,hint:`拆解时模型会先抽条目,覆盖率按条目统计。`})}):null]}),at?(0,N.jsxs)(`details`,{className:`mt-2 shrink-0 rounded-xl border border-stone-200 bg-white px-3 py-2`,children:[(0,N.jsx)(`summary`,{className:`cursor-pointer text-xs text-stone-500`,children:`模型说明(本轮)`}),(0,N.jsx)(`pre`,{className:`mt-1 max-h-[180px] overflow-y-auto whitespace-pre-wrap break-words text-[11px] leading-relaxed text-stone-600`,children:at})]}):null]}):(0,N.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center rounded-xl border border-stone-200 bg-white`,children:(0,N.jsx)(We,{icon:`file`,title:`还没有选来源`,hint:`左侧选一份「需求文档库」里的 Word / Excel / Markdown / txt,系统会新建一份分析。`})})]})]})]}),(0,N.jsx)(d,{open:Xt,title:`删除分析记录`,message:`确认删除「${C?v(C):``}」?故事、需求条目、体检报告与测试点都会一起清掉,来源需求文档不受影响。`,confirmLabel:`删除`,danger:`solid`,onClose:()=>Zt(!1),onConfirm:()=>void Kn()}),(0,N.jsx)(d,{open:Qt,title:`重新拆解`,message:`重新拆解会用模型结果替换当前 ${C?.stories.length??0} 个用户故事,旧体检报告、测试点与需求条目也会一起清掉,编号从 US-001 重新开始。`,confirmLabel:`重新拆解`,onClose:()=>$t(!1),onConfirm:()=>{$t(!1),Nn()}})]})}export{Xt as default};