lantern-harness 0.1.44 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +224 -0
- package/README.md +25 -8
- package/builtin/session/lh-fs.mjs +93 -4
- package/builtin/session/lh-nav-groups.mjs +3 -0
- package/builtin/session/mcp-client.mjs +7 -3
- package/builtin/session/session-runs.mjs +5 -1
- package/builtin/session/skill-validation.mjs +72 -0
- package/builtin/session/space-skills.mjs +751 -0
- package/cli/data-root.mjs +21 -4
- package/cli/lantern.mjs +26 -1
- package/cli/mcp-server.mjs +2779 -0
- package/cli/server.mjs +8 -2
- package/config/app.defaults.json +4 -2
- package/dist/500.html +9 -6
- package/dist/_astro/Base.Du_-4L-4.css +1 -0
- package/dist/_astro/Base.astro_astro_type_script_index_0_lang.XUV2H6ea.js +2 -0
- package/dist/_astro/BusinessMapBoard.mRxl2G3D.js +5 -0
- package/dist/_astro/CaseExecBoard.Cqkxuf5c.js +1 -0
- package/dist/_astro/CaseExecutionBoard.CjX4CoKd.js +5 -0
- package/dist/_astro/CaseGenerateApp.acgnxl79.js +10 -0
- package/dist/_astro/CasesLibrary.zmzOQwdn.js +21 -0
- package/dist/_astro/ChatApp.Ben9LFra.js +1 -0
- package/dist/_astro/ChatApp.DBi6q7Qv.js +262 -0
- package/dist/_astro/{ConfirmDialog.DrrPf1MB.js → ConfirmDialog.DQFd6g2r.js} +1 -1
- package/dist/_astro/DashboardBoard.CAJVE2G4.js +5 -0
- package/dist/_astro/{DatePicker.Bkl71M49.js → DatePicker.BRO_CjVQ.js} +1 -1
- package/dist/_astro/DefectSubmitEntry.BzKXJ-zq.js +2 -0
- package/dist/_astro/DocsFileBrowser.apKMbGVf.js +1 -0
- package/dist/_astro/{DocsPager.Duf4I68E.js → DocsPager.DMN9-Tjg.js} +1 -1
- package/dist/_astro/{DrawerField.BH3p4Q4D.js → DrawerField.CLdvmHc6.js} +1 -1
- package/dist/_astro/KnowledgeLibrary.BcoMQeUd.js +1 -0
- package/dist/_astro/LifeKrTasksBoard.DJU0-QI-.js +1 -0
- package/dist/_astro/LifeKrTodosBoard.GK7KRAO3.js +1 -0
- package/dist/_astro/LifeObjectivesBoard.DuKa6Q3k.js +1 -0
- package/dist/_astro/LifePlanTypeSelect.Cm2lUmnH.js +1 -0
- package/dist/_astro/{LifeReviewsBoard.BPXeVpg1.js → LifeReviewsBoard.BWOOVMtz.js} +3 -3
- package/dist/_astro/{LifeShared.tnT7aQON.js → LifeShared.bY2l01Ha.js} +2 -2
- package/dist/_astro/LifeStagesBoard.CIzxPOJB.js +1 -0
- package/dist/_astro/LifeYearCycleSelect.BlsyPmmI.js +1 -0
- package/dist/_astro/LifeYearPlansBoard.DaA9O08j.js +1 -0
- package/dist/_astro/MultiSelectDropdown.D-rbpivp.js +1 -0
- package/dist/_astro/{NamePromptDialog.Csfnh5eM.js → NamePromptDialog.KPCeXmri.js} +1 -1
- package/dist/_astro/NavLibraries.DVR5Ua-S.js +1 -0
- package/dist/_astro/PluginsPage.B063QIlQ.js +18 -0
- package/dist/_astro/PmBugsBoard.Cu-v0Gfd.js +1 -0
- package/dist/_astro/PmIterationsBoard.CgRzkP-j.js +1 -0
- package/dist/_astro/{PmProjectDetail.DneFVBpy.js → PmProjectDetail.DVCEh0Lm.js} +1 -1
- package/dist/_astro/PmProjectsBoard.z-bQa98r.js +1 -0
- package/dist/_astro/PmRequirementsBoard.B0W6bsW2.js +1 -0
- package/dist/_astro/PmRequirementsBoard.CyfBI0u_.js +1 -0
- package/dist/_astro/PmShared.BQVzwsiz.js +1 -0
- package/dist/_astro/ReportsPage.najSzJeT.js +1 -0
- package/dist/_astro/ReqAnalysisBoard.BQb8dHFD.js +39 -0
- package/dist/_astro/RequirementBreakdownLibrary.Cn6OV6xt.js +2 -0
- package/dist/_astro/RequirementsLibrary.CqKNFVsP.js +1 -0
- package/dist/_astro/SearchableSelect.DXclLMJI.js +1 -0
- package/dist/_astro/SelectDropdown.D7IeyHDI.js +1 -0
- package/dist/_astro/SettingsDialog.db3BpFw0.js +1 -0
- package/dist/_astro/SlideOverDrawer.BMg2tce6.js +1 -0
- package/dist/_astro/SpaceSwitcher.DSUVAPOi.js +7 -0
- package/dist/_astro/{TableFieldConfig.C7O-mL-p.js → TableFieldConfig.72AL-8p-.js} +1 -1
- package/dist/_astro/{TagSelect.UUXgkMqJ.js → TagSelect.B_r2p0fp.js} +1 -1
- package/dist/_astro/TasksBoard.CCDhCSR7.js +1 -0
- package/dist/_astro/TemplatesLibrary.peYzrHZ2.js +1 -0
- package/dist/_astro/TestReportsLibrary.fWiEyCRx.js +1 -0
- package/dist/_astro/TestStatsBoard.BSUBsWSu.js +1 -0
- package/dist/_astro/Toast.BydY-X7T.js +1 -0
- package/dist/_astro/TodosBoard.By5YdlUe.js +1 -0
- package/dist/_astro/UiAutoBoard.BGdlp5Sr.js +3 -0
- package/dist/_astro/UiAutoEnvPanel.BUASgPLB.js +10 -0
- package/dist/_astro/UiAutoGenerationDialog.D1PyCgrD.js +12 -0
- package/dist/_astro/UiAutoProjectsPage.B6A9NlVK.js +3 -0
- package/dist/_astro/app-config.Dvfzl5_N.js +1 -0
- package/dist/_astro/app-version.CNpnKIb9.js +1 -0
- package/dist/_astro/{bash-tools.D9HCzC_7.js → bash-tools.CS2w8LOb.js} +1 -1
- package/dist/_astro/business-map.BiJ85oxm.js +1 -0
- package/dist/_astro/business-map.DKwdW1VL.css +1 -0
- package/dist/_astro/case-gen-run.Cvvdv_kv.js +26 -0
- package/dist/_astro/case-prompt.CZ3vWUju.js +2 -0
- package/dist/_astro/{case-review.TdDs1WFM.js → case-review.DFWZkoR9.js} +1 -1
- package/dist/_astro/{case-template.Cd2xNbgy.js → case-template.Clb7HrDB.js} +1 -1
- package/dist/_astro/defect-submit.Dc49lFjm.css +1 -0
- package/dist/_astro/defect-workbench.CjTb4FDv.js +6 -0
- package/dist/_astro/dialog.XgRGNF_Q.js +1 -0
- package/dist/_astro/doc-roots.C-20VD0x.js +1 -0
- package/dist/_astro/{hydrate-cache.B15Nrpq0.js → hydrate-cache.O4CIma9y.js} +1 -1
- package/dist/_astro/i18n.Cp4so7KR.js +7 -0
- package/dist/_astro/{llm.DN5S1KBK.js → llm.BCYNgppW.js} +1 -1
- package/dist/_astro/mcp-tools.Kf-lupGn.js +7 -0
- package/dist/_astro/{open-docs-in-session.CRiZT022.js → open-docs-in-session.BpcAcBSI.js} +1 -1
- package/dist/_astro/plugins.Db9xoFZb.js +1 -0
- package/dist/_astro/project-docs.bB9lQ1Ki.js +1 -0
- package/dist/_astro/prompts-meta.VAjE4OET.js +2 -0
- package/dist/_astro/report-prompt.CwHuOcRN.js +1 -0
- package/dist/_astro/req-analysis.C_gARMrB.js +31 -0
- package/dist/_astro/requirement-breakdown-library.l0rPd7b3.js +1 -0
- package/dist/_astro/{settings.38J2uD5M.js → settings.D02wZj3w.js} +2 -2
- package/dist/_astro/space-skills.CPucW8zt.js +1 -0
- package/dist/_astro/{spaces-client.DV04tRyD.js → spaces-client.BAtG6PkW.js} +1 -1
- package/dist/_astro/story-review.DTN91Vl9.js +7 -0
- package/dist/_astro/test-points.C7ZgggQT.js +8 -0
- package/dist/_astro/test-reports.0gr6-c_0.js +19 -0
- package/dist/_astro/ui-auto-prompt.BmO3ja2m.js +8 -0
- package/dist/_astro/{view-prefs.DhdLZjGh.js → view-prefs.COAKEQtZ.js} +1 -1
- package/dist/business-map/index.html +983 -0
- package/dist/case-exec/index.html +10 -7
- package/dist/{prompts → case-execution}/index.html +12 -9
- package/dist/cases/generate/index.html +9 -6
- package/dist/cases/library/index.html +10 -7
- package/dist/dashboard/index.html +10 -7
- package/dist/defect-rules/index.html +690 -0
- package/dist/defect-submit/index.html +690 -0
- package/dist/defect-submit/templates/index.html +690 -0
- package/dist/docs/changelog/index.html +265 -51
- package/dist/docs/install/index.html +44 -12
- package/dist/docs/manual/index.html +213 -75
- package/dist/knowledge/index.html +10 -7
- package/dist/life/kr-tasks/index.html +10 -7
- package/dist/life/kr-todos/index.html +10 -7
- package/dist/life/objectives/index.html +10 -7
- package/dist/life/reviews/index.html +10 -7
- package/dist/life/stages/index.html +10 -7
- package/dist/life/year-plans/index.html +10 -7
- package/dist/plugins/index.html +10 -7
- package/dist/pm/bugs/index.html +10 -7
- package/dist/pm/iterations/index.html +10 -7
- package/dist/pm/projects/detail/index.html +10 -7
- package/dist/pm/projects/index.html +10 -7
- package/dist/pm/requirements/index.html +10 -7
- package/dist/reports/index.html +10 -7
- package/dist/requirement-analysis/index.html +10 -7
- package/dist/requirement-breakdowns/index.html +983 -0
- package/dist/requirements/index.html +10 -7
- package/dist/tasks/index.html +10 -7
- package/dist/templates/index.html +10 -7
- package/dist/test-automation/index.html +10 -7
- package/dist/test-automation/projects/index.html +10 -7
- package/dist/test-reports/index.html +10 -7
- package/dist/test-stats/index.html +10 -7
- package/dist/todos/index.html +10 -7
- package/dist/workbench/index.html +9 -6
- package/docs/Codex-MCP/351/233/206/346/210/220.md +296 -0
- package/docs//344/270/232/345/212/241/345/234/260/345/233/276/350/257/204/344/274/260.md +39 -0
- package/docs//344/270/232/345/212/241/345/234/260/345/233/276/350/257/206/345/210/253/351/207/215/346/236/204/346/226/271/346/241/210.md +88 -0
- package/docs//344/274/232/350/257/235/346/217/222/344/273/266.md +22 -3
- package/docs//345/205/250/345/261/200/346/217/222/344/273/266.md +41 -1
- package/docs//345/256/211/350/243/205/346/211/213/345/206/214.md +63 -17
- package/docs//346/217/222/344/273/266/344/273/223/345/272/223/344/270/216/346/212/200/350/203/275/346/225/264/345/220/210/346/226/271/346/241/210.md +187 -0
- package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +208 -69
- package/lh-plugins/business-map/assistant.mjs +958 -0
- package/lh-plugins/business-map/auth-paths.mjs +61 -0
- package/lh-plugins/business-map/jobs.mjs +749 -0
- package/lh-plugins/business-map/login.mjs +295 -0
- package/lh-plugins/business-map/sources.mjs +1014 -0
- package/lh-plugins/case-execution/files.mjs +777 -0
- package/lh-plugins/case-execution/service.mjs +959 -0
- package/lh-plugins/case-execution-prompt.mjs +33 -0
- package/lh-plugins/lh-business-map.mjs +2431 -0
- package/lh-plugins/lh-case-execution.mjs +304 -0
- package/lh-plugins/lh-config.mjs +13 -0
- package/lh-plugins/lh-defect-submit.mjs +989 -0
- package/lh-plugins/lh-project-docs.mjs +31 -140
- package/lh-plugins/lh-reports.mjs +29 -57
- package/lh-plugins/lh-req-analysis.mjs +32 -3
- package/lh-plugins/lh-req-breakdown-library.mjs +1084 -0
- package/lh-plugins/lh-uiauto.mjs +514 -22
- package/lh-plugins/plugin-prompts.mjs +19 -15
- package/lh-plugins/req-analysis-revision.mjs +24 -0
- package/lh-plugins/test-points-prompt.mjs +2 -3
- package/lh-plugins/uiauto-auth-setup.mjs +218 -0
- package/lh-plugins/uiauto-explorer/apps.mjs +13 -2
- package/lh-plugins/uiauto-explorer/runner.mjs +15 -2
- package/lh-plugins/uiauto-explorer/sessions.mjs +305 -17
- package/lh-plugins/uiauto-node.mjs +102 -11
- package/lh-plugins/uiauto-prompt.mjs +20 -15
- package/lh-plugins/uiauto-sso.mjs +407 -0
- package/package.json +5 -2
- package/skills/case-execution/SKILL.md +30 -0
- package/skills/lantern-defect-submit/SKILL.md +15 -0
- package/skills/lantern-workflow/SKILL.md +57 -0
- package/skills/office/SKILL.md +26 -0
- package/dist/_astro/Base.DIbzr8uT.css +0 -1
- package/dist/_astro/Base.astro_astro_type_script_index_0_lang.CPR_CfsE.js +0 -2
- package/dist/_astro/CaseExecBoard.DICluCbK.js +0 -1
- package/dist/_astro/CaseGenerateApp.CcAtVSQJ.js +0 -10
- package/dist/_astro/CasesLibrary.Ci_0hYqL.js +0 -21
- package/dist/_astro/ChatApp.DFKZOkZy.js +0 -227
- package/dist/_astro/DashboardBoard.Qvf8o4v1.js +0 -5
- package/dist/_astro/DocsFileBrowser.DwKBffbM.js +0 -1
- package/dist/_astro/KnowledgeLibrary.MDpMqeOd.js +0 -1
- package/dist/_astro/LifeKrTasksBoard.DsvW_S66.js +0 -1
- package/dist/_astro/LifeKrTodosBoard.D2KTqvg1.js +0 -1
- package/dist/_astro/LifeObjectivesBoard.B0cDK934.js +0 -1
- package/dist/_astro/LifePlanTypeSelect.BELDvMWU.js +0 -1
- package/dist/_astro/LifeStagesBoard.CZftLR9K.js +0 -1
- package/dist/_astro/LifeYearCycleSelect.Bw2eRbSm.js +0 -1
- package/dist/_astro/LifeYearPlansBoard.DB-RJFEl.js +0 -1
- package/dist/_astro/MultiSelectDropdown.CBC7aNOv.js +0 -1
- package/dist/_astro/NavLibraries.DdQYsZbe.js +0 -1
- package/dist/_astro/OverflowHint.CHZeFfUj.js +0 -1
- package/dist/_astro/PluginsPage.BVrMtkLi.js +0 -17
- package/dist/_astro/PluginsPage.xdbDGigE.js +0 -1
- package/dist/_astro/PmBugsBoard.CGpXUTPu.js +0 -1
- package/dist/_astro/PmIterationsBoard.BaKiFIam.js +0 -1
- package/dist/_astro/PmProjectsBoard.BxoMF9gK.js +0 -1
- package/dist/_astro/PmRequirementsBoard.-SI8VZXI.js +0 -1
- package/dist/_astro/PmRequirementsBoard.DsK6RF7Q.js +0 -1
- package/dist/_astro/PmShared.BK8kWRSV.js +0 -1
- package/dist/_astro/PromptMountDialog.mrTx3U5T.js +0 -1
- package/dist/_astro/PromptsLibrary.B2LMGsrj.js +0 -1
- package/dist/_astro/ReportsPage.B9lGg1_s.js +0 -16
- package/dist/_astro/ReqAnalysisBoard.D-KmRwQM.js +0 -39
- package/dist/_astro/RequirementsLibrary.cJc-bnGQ.js +0 -1
- package/dist/_astro/SearchableSelect.SyLRS-Jj.js +0 -1
- package/dist/_astro/SelectDropdown.T3CKHaLt.js +0 -1
- package/dist/_astro/SettingsDialog.C62iJkMt.js +0 -1
- package/dist/_astro/SpaceSwitcher.C47_S1g9.js +0 -7
- package/dist/_astro/TasksBoard.BUEg2BYk.js +0 -1
- package/dist/_astro/TemplatesLibrary.BLVIphXO.js +0 -1
- package/dist/_astro/TestReportsLibrary.DVq30Jae.js +0 -1
- package/dist/_astro/TestStatsBoard.-5BWQ6bI.js +0 -1
- package/dist/_astro/Toast.BO2NFckG.js +0 -1
- package/dist/_astro/TodosBoard.DI_lTp2e.js +0 -1
- package/dist/_astro/UiAutoBoard.ChFdgv7s.js +0 -2
- package/dist/_astro/UiAutoEnvPanel.B50q4kYb.js +0 -19
- package/dist/_astro/UiAutoGenerationDialog.CLkFAHrm.js +0 -1
- package/dist/_astro/UiAutoProjectsPage.DCsDeN5d.js +0 -3
- package/dist/_astro/app-config.DkyjuL-S.js +0 -1
- package/dist/_astro/app-version.3eY3FSw1.js +0 -1
- package/dist/_astro/case-gen-run.BQeK-XUw.js +0 -22
- package/dist/_astro/case-types.DlFkbZJN.js +0 -1
- package/dist/_astro/dialog.DZHZCe_T.js +0 -1
- package/dist/_astro/doc-roots.CO3IBiY6.js +0 -1
- package/dist/_astro/i18n.D_aOCHSN.js +0 -7
- package/dist/_astro/markdown-client.BS19nLL3.js +0 -62
- package/dist/_astro/plugins.BRvXWHLe.js +0 -1
- package/dist/_astro/project-docs.CCjtiFjB.js +0 -1
- package/dist/_astro/prompts-meta.BUGutlsk.js +0 -2
- package/dist/_astro/report-prompt.B9C4cv84.js +0 -1
- package/dist/_astro/req-analysis.FrD6BfwK.js +0 -31
- package/dist/_astro/story-review.R8iWiFzl.js +0 -14
- package/dist/_astro/test-reports.CuIjlEyK.js +0 -19
- package/dist/_astro/ui-auto-prompt.H9_yhau9.js +0 -9
- package/dist/_astro/ui-auto.DMv940x4.js +0 -1
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
function e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var t=e();function n(e){t=e}var r={exec:()=>null};function i(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(a.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var a={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`)},o=/^(?:[ \t]*(?:\n|$))+/,s=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,c=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,l=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,u=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,d=/(?:[*+-]|\d{1,9}[.)])/,f=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,p=i(f).replace(/bull/g,d).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(),ee=i(f).replace(/bull/g,d).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(),te=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ne=/^[^\n]+/,m=/(?!\s*\])(?:\\.|[^\[\]\\])+/,re=i(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,m).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ie=i(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,d).getRegex(),h=`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`,g=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ae=i(`^ {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`,g).replace(`tag`,h).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),_=i(te).replace(`hr`,l).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`,h).getRegex(),v={blockquote:i(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,_).getRegex(),code:s,def:re,fences:c,heading:u,hr:l,html:ae,lheading:p,list:ie,newline:o,paragraph:_,table:r,text:ne},oe=i(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,l).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`,h).getRegex(),se={...v,lheading:ee,table:oe,paragraph:i(te).replace(`hr`,l).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,oe).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`,h).getRegex()},y={...v,html:i(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,g).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:r,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:i(te).replace(`hr`,l).replace(`heading`,` *#{1,6} *[^
|
|
2
|
-
]`).replace(`lheading`,p).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},b=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ce=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,le=/^( {2,}|\\)\n(?!\s*$)/,ue=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,de=/[\p{P}\p{S}]/u,x=/[\s\p{P}\p{S}]/u,fe=/[^\s\p{P}\p{S}]/u,pe=i(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,x).getRegex(),me=/(?!~)[\p{P}\p{S}]/u,he=/(?!~)[\s\p{P}\p{S}]/u,ge=/(?:[^\s\p{P}\p{S}]|~)/u,_e=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,ve=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,ye=i(ve,`u`).replace(/punct/g,de).getRegex(),S=i(ve,`u`).replace(/punct/g,me).getRegex(),be=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,xe=i(be,`gu`).replace(/notPunctSpace/g,fe).replace(/punctSpace/g,x).replace(/punct/g,de).getRegex(),Se=i(be,`gu`).replace(/notPunctSpace/g,ge).replace(/punctSpace/g,he).replace(/punct/g,me).getRegex(),Ce=i(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,fe).replace(/punctSpace/g,x).replace(/punct/g,de).getRegex(),we=i(/\\(punct)/,`gu`).replace(/punct/g,de).getRegex(),Te=i(/^<(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(),Ee=i(g).replace(`(?:-->|$)`,`-->`).getRegex(),De=i(`^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`,Ee).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Oe=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,C=i(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace(`label`,Oe).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ke=i(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Oe).replace(`ref`,m).getRegex(),w=i(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,m).getRegex(),Ae={_backpedal:r,anyPunctuation:we,autolink:Te,blockSkip:_e,br:le,code:ce,del:r,emStrongLDelim:ye,emStrongRDelimAst:xe,emStrongRDelimUnd:Ce,escape:b,link:C,nolink:w,punctuation:pe,reflink:ke,reflinkSearch:i(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,ke).replace(`nolink`,w).getRegex(),tag:De,text:ue,url:r},T={...Ae,link:i(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Oe).getRegex(),reflink:i(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Oe).getRegex()},je={...Ae,emStrongRDelimAst:Se,emStrongLDelim:S,url:i(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},Me={...je,br:i(le).replace(`{2,}`,`*`).getRegex(),text:i(je.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},E={normal:v,gfm:se,pedantic:y},Ne={normal:Ae,gfm:je,breaks:Me,pedantic:T},Pe={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Fe=e=>Pe[e];function D(e,t){if(t){if(a.escapeTest.test(e))return e.replace(a.escapeReplace,Fe)}else if(a.escapeTestNoEncode.test(e))return e.replace(a.escapeReplaceNoEncode,Fe);return e}function O(e){try{e=encodeURI(e).replace(a.percentDecode,`%`)}catch{return null}return e}function k(e,t){let n=e.replace(a.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(a.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(a.slashPipe,`|`);return n}function A(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 Ie(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 Le(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 Re(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 ze=class{options;rules;lexer;constructor(e){this.options=e||t}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:A(e,`
|
|
5
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Re(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=A(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:A(t[0],`
|
|
6
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=A(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=k(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(k(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=A(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Ie(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)),Le(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 Le(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}}}},j=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||t,this.options.tokenizer=this.options.tokenizer||new ze,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 n={other:a,block:E.normal,inline:Ne.normal};this.options.pedantic?(n.block=E.pedantic,n.inline=Ne.pedantic):this.options.gfm&&(n.block=E.gfm,n.inline=this.options.breaks?Ne.breaks:Ne.gfm),this.tokenizer.rules=n}static get rules(){return{block:E,inline:Ne}}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(a.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(a.tabCharGlobal,` `).replace(a.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}},Be=class{options;parser;constructor(e){this.options=e||t}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(a.notSpaceStart)?.[0],i=e.replace(a.endingNewline,``)+`
|
|
37
|
-
`;return r?`<pre><code class="language-`+D(r)+`">`+(n?i:D(i,!0))+`</code></pre>
|
|
38
|
-
`:`<pre><code>`+(n?i:D(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+` `+D(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>${D(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=O(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+D(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=O(e);if(i===null)return D(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${D(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:D(e.text)}},Ve=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``}},M=class e{options;renderer;textRenderer;constructor(e){this.options=e||t,this.options.renderer=this.options.renderer||new Be,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ve}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}},He=class{options;block;constructor(e){this.options=e||t}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?j.lex:j.lexInline}provideParser(){return this.block?M.parse:M.parseInline}},Ue=class{defaults=e();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=M;Renderer=Be;TextRenderer=Ve;Lexer=j;Tokenizer=ze;Hooks=He;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 Be(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 ze(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 He;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]=He.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 j.lex(e,t??this.defaults)}parser(e,t){return M.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?j.lex:j.lexInline,s=i.hooks?i.hooks.provideParser():e?M.parse:M.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>`+D(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},N=new Ue;function P(e,t){return N.parse(e,t)}P.options=P.setOptions=function(e){return N.setOptions(e),P.defaults=N.defaults,n(P.defaults),P},P.getDefaults=e,P.defaults=t,P.use=function(...e){return N.use(...e),P.defaults=N.defaults,n(P.defaults),P},P.walkTokens=function(e,t){return N.walkTokens(e,t)},P.parseInline=N.parseInline,P.Parser=M,P.parser=M.parse,P.Renderer=Be,P.TextRenderer=Ve,P.Lexer=j,P.lexer=j.lex,P.Tokenizer=ze,P.Hooks=He,P.parse=P,P.options,P.setOptions,P.use,P.walkTokens,P.parseInline,M.parse,j.lex;function F(e,t){this.v=e,this.k=t}function I(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 L(e){if(Array.isArray(e))return e}function We(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 Ge(){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 Ke(e,t){return L(e)||We(e,t)||qe(e,t)||Ge()}function qe(e,t){if(e){if(typeof e==`string`)return I(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)?I(e,t):void 0}}function Je(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof F;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)}Je.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},Je.prototype.next=function(e){return this._invoke(`next`,e)},Je.prototype.throw=function(e){return this._invoke(`throw`,e)},Je.prototype.return=function(e){return this._invoke(`return`,e)};var Ye=Object.entries,Xe=Object.setPrototypeOf,Ze=Object.isFrozen,R=Object.getPrototypeOf,z=Object.getOwnPropertyDescriptor,B=Object.freeze,V=Object.seal,Qe=Object.create,$e=typeof Reflect<`u`&&Reflect,et=$e.apply,tt=$e.construct;B||=function(e){return e},V||=function(e){return e},et||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},tt||=function(e){return new e(...[...arguments].slice(1))};var H=K(Array.prototype.forEach);Array.prototype.indexOf;var nt=K(Array.prototype.lastIndexOf),rt=K(Array.prototype.pop),it=K(Array.prototype.push),at=K(Array.prototype.slice),ot=K(Array.prototype.splice),st=Array.isArray,ct=St(Set),lt=K(Set.prototype.add),ut=K(Set.prototype.has),dt=K(String.prototype.toLowerCase),ft=K(String.prototype.toString),pt=K(String.prototype.match),mt=K(String.prototype.replace),ht=K(String.prototype.indexOf),gt=K(String.prototype.trim),_t=K(Number.prototype.toString),vt=K(Boolean.prototype.toString),yt=typeof BigInt>`u`?null:K(BigInt.prototype.toString),bt=typeof Symbol>`u`?null:K(Symbol.prototype.toString),U=K(Object.prototype.hasOwnProperty),xt=K(Object.prototype.toString),W=K(RegExp.prototype.test),G=St(TypeError);function K(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return et(e,t,n)}}function St(e){return function(){return tt(e,[...arguments])}}function q(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:dt;if(Xe&&Xe(e,null),!st(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Ze(t)||(t[r]=e),i=e)}e[i]=!0}return e}function J(e){for(let t=0;t<e.length;t++)U(e,t)||(e[t]=null);return e}function Y(e){let t=Qe(null);for(let r of Ye(e)){var n=Ke(r,2);let i=n[0],a=n[1];U(e,i)&&(t[i]=st(a)?J(a):a&&typeof a==`object`&&a.constructor===Object?Y(a):a)}return t}function Ct(e){switch(typeof e){case`string`:return e;case`number`:return _t(e);case`boolean`:return vt(e);case`bigint`:return yt?yt(e):`0`;case`symbol`:return bt?bt(e):`Symbol()`;case`undefined`:return xt(e);case`function`:case`object`:{if(e===null)return xt(e);let t=e,n=X(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:xt(e)}return xt(e)}default:return xt(e)}}function X(e,t){for(;e!==null;){let n=z(e,t);if(n){if(n.get)return K(n.get);if(typeof n.value==`function`)return K(n.value)}e=R(e)}function n(){return null}return n}function wt(e,t){for(;e!==null;){let n=z(e,t);if(n)return n.get?K(n.get):null;e=R(e)}return null}function Tt(e){try{return W(e,``),!0}catch{return!1}}var Et=B(`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(`.`)),Dt=B(`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(`.`)),Ot=B([`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`]),kt=B([`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`]),At=B(`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(`.`)),jt=B([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Mt=B([`#text`]),Nt=B(`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(`.`)),Pt=B(`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(`.`)),Ft=B(`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(`.`)),It=B([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Lt=V(/{{[\w\W]*|^[\w\W]*}}/g),Rt=V(/<%[\w\W]*|^[\w\W]*%>/g),zt=V(/\${[\w\W]*/g),Bt=V(/^data-[\-\w.\u00B7-\uFFFF]+$/),Vt=V(/^aria-[\-\w]+$/),Ht=V(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ut=V(/^(?:\w+script|data):/i),Wt=V(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Gt=V(/^html$/i),Kt=V(/^[a-z][.\w]*(-[.\w]+)+$/i),qt=V(/<[/\w!]/g),Jt=V(/<[/\w]/g),Yt=V(/<\/no(script|embed|frames)/i),Xt=V(/\/>/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},Zt=B(q({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),Qt=function(){return typeof window>`u`?null:window},$t=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}},en=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},tn=function(e,t,n,r){return U(e,t)&&st(e[t])?q(r.base?Y(r.base):{},e[t],r.transform):n},nn=function(e,t,n){let r=U(e,t)?e[t]:void 0;return r&&typeof r==`object`?Y(r):n()};function rn(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Qt(),t=e=>rn(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`),ne=X(d,`childNodes`),m=X(d,`parentNode`),re=X(d,`shadowRoot`),ie=X(d,`attributes`),h=o&&o.prototype?X(o.prototype,`nodeType`):null,g=o&&o.prototype?X(o.prototype,`nodeName`):null,ae=o&&o.prototype?X(o.prototype,`ownerDocument`):null,_=function(e){return h?h(e):e.nodeType},v=function(e){return g?g(e):e.nodeName},oe=wt(d,`namespaceURI`),se=function(e){return oe?oe(e):e.namespaceURI};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let y,b=``,ce,le=!1,ue=0,de=function(){if(ue>0)throw G(`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.`)},x=function(e){de(),ue++;try{return y.createHTML(e)}finally{ue--}},fe=function(e){de(),ue++;try{return y.createScriptURL(e)}finally{ue--}},pe=function(){return le||=(ce=$t(u,i),!0),ce},me=n,he=me.implementation,ge=me.createNodeIterator,_e=me.createDocumentFragment,ve=me.getElementsByTagName,ye=r.importNode,S=en();t.isSupported=typeof Ye==`function`&&typeof m==`function`&&he&&he.createHTMLDocument!==void 0;let be=Lt,xe=Rt,Se=zt,Ce=Bt,we=Vt,Te=Ut,Ee=Wt,De=Kt,Oe=Ht,C=null,ke=q({},[...Et,...Dt,...Ot,...At,...Mt]),w=null,Ae=q({},[...Nt,...Pt,...Ft,...It]),T=Object.seal(Qe(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}})),je=null,Me=null,E=Object.seal(Qe(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ne=!0,Pe=!0,Fe=!1,D=!0,O=!1,k=!0,A=!1,Ie=!1,Le=null,Re=null,ze=!1,j=!1,Be=!1,Ve=!1,M=!0,He=!1,Ue=`user-content-`,N=!0,P=!1,F=null,I={},L=null,We=q({},`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=q({},[`audio`,`video`,`img`,`source`,`image`,`track`]),qe=null,Je=q({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Xe=`http://www.w3.org/1998/Math/MathML`,Ze=`http://www.w3.org/2000/svg`,R=`http://www.w3.org/1999/xhtml`,z=R,$e=!1,et=null,tt=q({},[Xe,Ze,R],ft),_t=B([`mi`,`mo`,`mn`,`ms`,`mtext`]),vt=q({},_t),yt=B([`annotation-xml`]),bt=q({},yt),xt=q({},[`title`,`style`,`font`,`a`,`script`]),K=null,St=[`application/xhtml+xml`,`text/html`],J=null,an=null,on=n.createElement(`form`),sn=function(e){return e instanceof RegExp||e instanceof Function},cn=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(an&&an===e)return;(!e||typeof e!=`object`)&&(e={}),e=Y(e),K=St.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,J=K===`application/xhtml+xml`?ft:dt,C=tn(e,`ALLOWED_TAGS`,ke,{transform:J}),w=tn(e,`ALLOWED_ATTR`,Ae,{transform:J}),et=tn(e,`ALLOWED_NAMESPACES`,tt,{transform:ft}),qe=tn(e,`ADD_URI_SAFE_ATTR`,Je,{transform:J,base:Je}),Ge=tn(e,`ADD_DATA_URI_TAGS`,Ke,{transform:J,base:Ke}),L=tn(e,`FORBID_CONTENTS`,We,{transform:J}),je=tn(e,`FORBID_TAGS`,Y({}),{transform:J}),Me=tn(e,`FORBID_ATTR`,Y({}),{transform:J}),I=U(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Y(e.USE_PROFILES):e.USE_PROFILES:!1,Ne=e.ALLOW_ARIA_ATTR!==!1,Pe=e.ALLOW_DATA_ATTR!==!1,Fe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,D=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,O=e.SAFE_FOR_TEMPLATES||!1,k=e.SAFE_FOR_XML!==!1,A=e.WHOLE_DOCUMENT||!1,j=e.RETURN_DOM||!1,Be=e.RETURN_DOM_FRAGMENT||!1,Ve=e.RETURN_TRUSTED_TYPE||!1,ze=e.FORCE_BODY||!1,M=e.SANITIZE_DOM!==!1,He=e.SANITIZE_NAMED_PROPS||!1,N=e.KEEP_CONTENT!==!1,P=e.IN_PLACE||!1,Oe=Tt(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Ht,z=typeof e.NAMESPACE==`string`?e.NAMESPACE:R,vt=nn(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>q({},_t)),bt=nn(e,`HTML_INTEGRATION_POINTS`,()=>q({},yt));let t=nn(e,`CUSTOM_ELEMENT_HANDLING`,()=>Qe(null));if(T=Qe(null),U(t,`tagNameCheck`)&&sn(t.tagNameCheck)&&(T.tagNameCheck=t.tagNameCheck),U(t,`attributeNameCheck`)&&sn(t.attributeNameCheck)&&(T.attributeNameCheck=t.attributeNameCheck),U(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(T.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),V(T),O&&(Pe=!1),Be&&(j=!0),I&&(C=q({},Mt),w=Qe(null),I.html===!0&&(q(C,Et),q(w,Nt)),I.svg===!0&&(q(C,Dt),q(w,Pt),q(w,It)),I.svgFilters===!0&&(q(C,Ot),q(w,Pt),q(w,It)),I.mathMl===!0&&(q(C,At),q(w,Ft),q(w,It))),E.tagCheck=null,E.attributeCheck=null,U(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?E.tagCheck=e.ADD_TAGS:st(e.ADD_TAGS)&&(C===ke&&(C=Y(C)),q(C,e.ADD_TAGS,J))),U(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?E.attributeCheck=e.ADD_ATTR:st(e.ADD_ATTR)&&(w===Ae&&(w=Y(w)),q(w,e.ADD_ATTR,J))),U(e,`ADD_FORBID_CONTENTS`)&&st(e.ADD_FORBID_CONTENTS)&&(L===We&&(L=Y(L)),q(L,e.ADD_FORBID_CONTENTS,J)),N&&(C[`#text`]=!0),A&&q(C,[`html`,`head`,`body`]),C.table&&(q(C,[`tbody`]),delete je.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw G(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw G(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=y;y=e.TRUSTED_TYPES_POLICY;try{b=x(``)}catch(e){throw y=t,e}}else e.TRUSTED_TYPES_POLICY===null?(y=void 0,b=``):(y===void 0&&(y=pe()),y&&typeof b==`string`&&(b=x(``)));B&&B(e),an=e},ln=q({},[...Dt,...Ot,...kt]),un=q({},[...At,...jt]),dn=function(e,t,n){return t.namespaceURI===R?e===`svg`:t.namespaceURI===Xe?e===`svg`&&(n===`annotation-xml`||vt[n]):!!ln[e]},fn=function(e,t,n){return t.namespaceURI===R?e===`math`:t.namespaceURI===Ze?e===`math`&&bt[n]:!!un[e]},pn=function(e,t,n){return t.namespaceURI===Ze&&!bt[n]||t.namespaceURI===Xe&&!vt[n]?!1:!un[e]&&(xt[e]||!ln[e])},mn=function(e){let t=se(e),n=dt(v(e)),r=m(e),i,a;return r&&_(r)===Z.element?(i={namespaceURI:se(r)},a=dt(v(r))):(i={namespaceURI:z},a=`template`),et[t]?t===Ze?dn(n,i,a):t===Xe?fn(n,i,a):t===R?pn(n,i,a):!!(K===`application/xhtml+xml`&&et[t]):!1},hn=function(e){it(t.removed,{element:e});try{m(e).removeChild(e)}catch{if(p(e),!m(e))throw G(`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){xn(e);let t=ne(e);t&&H(at(t),e=>{try{p(e)}catch{}});let n=_(e)===Z.element?ie(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}it(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(j||Be)try{hn(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},yn=function(e){let t=ie(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||w[J(i)]||gn(e,r,i)}},bn=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&&_(e)===Z.element){let t=re(e);Q(t)&&r.push(t)}let i=ne(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},xn=function(e){bn(e,e=>{_(e)===Z.element&&yn(e)})},Sn=function(e){let t=[];return bn(e,e=>{t.push(e)},!0),t},Cn=function(e,t){let n=ct();H(Sn(e),e=>{_(e)===Z.element&<(n,e)}),H(t,e=>{_(e)===Z.element&&!ut(n,e)&&yn(e)})},wn=function(e,n){let r=!1;return H(t.removed,t=>{t.element&&(r||=t.element===e,xn(t.element))}),Cn(e,n),r},Tn=function(e,t){let n=F,r=null,i=()=>(r||(r=ct(),H(t,e=>{lt(r,e)})),r);for(let t=0;;t++){let r=Sn(e),a=[e],o=!1;if(H(r,e=>{_(e)===Z.documentFragment?it(a,e):!o&&!ut(n,e)&&(o=ut(i(),e))}),!o)return;if(t>=8)throw G(`the tree kept changing during in-place sanitization; refusing to return it`);H(a,(t,n)=>{En(t,n>0,e,i())})}},En=function(e,t,n,r){let i=jn(e),a;for(;a=i.nextNode();)ut(r,a)&&!ut(F,a)&&(t&&$(S.uponSanitizeShadowNode,a,null),Hn(a,n),Yn(a,n),Q(a.content)&&Xn(a.content))},Dn=function(e){F&<(F,e)},On=function(e,t){return k?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},kn=function(e){k&&bn(e,e=>{let t=_(e);if(t===Z.processingInstruction||t===Z.comment&&W(Jt,e.data)){try{p(e)}catch{}return!1}if(t===Z.element){let t=e,n=J(v(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&On(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},An=function(e){let t=null,r=null;if(ze)e=`<remove></remove>`+e;else{let t=pt(e,/^[\r\n\t ]+/);r=t&&t[0]}K===`application/xhtml+xml`&&z===R&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=y?x(e):e;if(z===R)try{t=new l().parseFromString(i,K)}catch{}if(!t||!t.documentElement){t=he.createDocument(z,`template`,null);try{t.documentElement.innerHTML=$e?b:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),z===R?ve.call(t,A?`html`:`body`)[0]:A?t.documentElement:a},jn=function(e){let t=ae?ae(e):e.ownerDocument;return ge.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Mn=function(e){return e=mt(e,be,` `),e=mt(e,xe,` `),e=mt(e,Se,` `),e},Nn=function(e){Pn(e);let t=e.querySelectorAll?.call(e,`template`);t&&H(t,e=>{Q(e.content)&&Nn(e.content)})},Pn=function(e){e.normalize();let t=ae?ae(e):e.ownerDocument,n=ge.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=Mn(r.data),r=n.nextNode()},Fn=function(e){let t=g?g(e):null;return typeof t!=`string`||J(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==ie(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!==h(e)||e.childNodes!==ne(e)},Q=function(e){if(!h||typeof e!=`object`||!e)return!1;try{return h(e)===Z.documentFragment}catch{return!1}},In=function(e){if(!h||typeof e!=`object`||!e)return!1;try{return typeof h(e)==`number`}catch{return!1}};function $(e,n,r){e.length!==0&&H(e,e=>{e.call(t,n,r,an)})}let Ln=function(e,t){return!!(k&&e.hasChildNodes()&&!In(e.firstElementChild)&&W(qt,e.textContent)&&W(qt,e.innerHTML)||k&&Zt[t]&&_(e)===Z.element&&se(e)===R&&(In(e.firstElementChild)||typeof e.textContent==`string`&&W(qt,e.textContent))||e.nodeType===Z.processingInstruction||k&&e.nodeType===Z.comment&&W(Jt,e.data))},Rn=function(e,t){return e instanceof RegExp?W(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},zn=function(e,t,n){if(!je[t]&&Gn(t)&&Rn(T.tagNameCheck,t))return!1;if(N&&!L[t]&&!L[dt(t)]){let t=m(e),r=ne(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||m(e)!==null?!1:(P&&xn(e),!0)},Hn=function(e,n){if(Dn(e),$(S.beforeSanitizeElements,e,null),Vn(e,n))return!0;if(Fn(e))return hn(e),!0;let r=J(v(e));if(C=Bn(S.uponSanitizeElement,C,ke,Le),$(S.uponSanitizeElement,e,{tagName:r,allowedTags:C}),Vn(e,n))return!0;if(Ln(e,r))return hn(e),!0;if(je[r]||!(E.tagCheck instanceof Function&&E.tagCheck(r))&&!C[r]){let t=zn(e,r,n);return t===!1&&($(S.afterSanitizeElements,e,null),Vn(e,n))?!0:t}if(_(e)===Z.element&&!mn(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&W(Yt,e.innerHTML))return hn(e),!0;if(O&&e.nodeType===Z.text){let n=Mn(e.textContent);e.textContent!==n&&(it(t.removed,{element:e.cloneNode()}),e.textContent=n)}return $(S.afterSanitizeElements,e,null),Vn(e,n)},Un=function(e,t,r){if(Me[t]||On(t,e)||M&&(t===`id`||t===`name`)&&(r in n||r in on))return!1;let i=w[t]||E.attributeCheck instanceof Function&&E.attributeCheck(t,e);return Pe&&W(Ce,t)||Ne&&W(we,t)?!0:i?qe[t]||W(Oe,mt(r,Ee,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&ht(r,`data:`)===0&&Ge[e]||Fe&&!W(Te,mt(r,Ee,``))?!0:!r:Gn(e)&&Rn(T.tagNameCheck,e)&&Rn(T.attributeNameCheck,t,e)||t===`is`&&T.allowCustomizedBuiltInElements&&Rn(T.tagNameCheck,r)},Wn=q({},[`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[dt(e)]&&W(De,e)},Kn=function(e,t,n,r){if(y&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return x(r);case`TrustedScriptURL`:return fe(r)}return r},qn=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Fn(e)||(hn(e),!1)}catch{return vn(t,e),!1}},Jn=function(e,t){return k&&W(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:dt(e)===`attributename`&&pt(t,`href`)!==null},Yn=function(e,n){if($(S.beforeSanitizeAttributes,e,null),Vn(e,n))return;let r=e.attributes;if(!r||Fn(e))return;w=Bn(S.uponSanitizeAttribute,w,Ae,Re);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:w,forceKeepAttr:void 0},a=r.length,o=J(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=J(s),d=l,f=s===`value`?d:gt(d),p=!1;i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,$(S.uponSanitizeAttribute,e,i),f=i.attrValue,He&&(u===`id`||u===`name`)&&ht(f,Ue)!==0&&(vn(s,e,n),f=Ue+f,p=!0),Jn(s,f)?vn(s,e,n):i.forceKeepAttr||(i.keepAttr?!D&&W(Xt,f)?vn(s,e,n):(O&&(f=Mn(f)),Un(o,u,f)?(f=Kn(o,u,c,f),f!==d&&qn(e,s,c,f)&&p&&rt(t.removed)):vn(s,e,n)):vn(s,e,n))}$(S.afterSanitizeAttributes,e,null),Vn(e,n)},Xn=function(e){let t=null,n=jn(e);for($(S.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if($(S.uponSanitizeShadowNode,t,null),Hn(t,e),Yn(t,e),Q(t.content)&&Xn(t.content),_(t)===Z.element){let e=re(t);Q(e)&&(Zn(e),Xn(e))}O&&Pn(e),$(S.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=_(n)===Z.element,i=ne(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=g?g(n):null;if(typeof e==`string`&&J(e)===`template`){let e=n.content;Q(e)&&t.push({node:e,shadow:null})}}if(r){let e=re(n);Q(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($e=!e,$e&&(e=`<!-->`),typeof e!=`string`&&!In(e)&&(e=Ct(e),typeof e!=`string`))throw G(`dirty is not a string, aborting`);if(!t.isSupported)return e;Ie?(C=Le,w=Re):cn(n),(S.uponSanitizeElement.length>0||S.uponSanitizeAttribute.length>0)&&(C=Y(C)),S.uponSanitizeAttribute.length>0&&(w=Y(w)),t.removed=[];let c=P&&typeof e!=`string`&&In(e),l=[],u=F;if(c){kn(e);let t=v(e);if(typeof t==`string`){let n=J(t);if(!C[n]||je[n])throw _n(e),G(`root node is forbidden and cannot be sanitized in-place`)}if(Fn(e))throw _n(e),G(`root node is clobbered and cannot be sanitized in-place`);l=Sn(e),F=ct()}else if(In(e))i=An(`<!---->`),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(!j&&!O&&!A&&e.indexOf(`<`)===-1)return y&&Ve?x(e):e;if(i=An(e),!i)return j?null:Ve?b:``}i&&ze&&hn(i.firstChild);let d=c?e:i;try{c&&Zn(e);let t=jn(d);for(;o=t.nextNode();)Hn(o,d),Yn(o,d),Q(o.content)&&Xn(o.content);c&&Tn(e,l)}catch(t){throw c&&(_n(e),wn(e,l)),t}finally{F=u}if(c){if(wn(e,l))throw G(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return O&&Nn(e),e}if(j){if(O&&Nn(i),Be)for(s=_e.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(w.shadowroot||w.shadowrootmode)&&(s=ye.call(r,s,!0)),s}let f=A?i.outerHTML:i.innerHTML;return A&&C[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&W(Gt,i.ownerDocument.doctype.name)&&(f=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
58
|
-
`+f),O&&(f=Mn(f)),y&&Ve?x(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};cn(e),Ie=!0,Le=C,Re=w},t.clearConfig=function(){an=null,Ie=!1,Le=null,Re=null,y=ce,b=``},t.isValidAttribute=function(e,t,n){an||cn({});let r=J(e),i=J(t);return typeof n==`string`&&(Jn(t,n)||!D&&W(Xt,n))?!1:Un(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&U(S,e)&&it(S[e],t)},t.removeHook=function(e,t){if(U(S,e)){if(t!==void 0){let n=nt(S[e],t);return n===-1?void 0:ot(S[e],n,1)[0]}return rt(S[e])}},t.removeHooks=function(e){U(S,e)&&(S[e]=[])},t.removeAllHooks=function(){S=en()},t}var an=rn();function on(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}var sn=new Ue({renderer:{code({text:e,lang:t,escaped:n}){return`<div class="code-block"><div class="code-block-head"><span>${on((t??``).trim().split(/\s+/)[0]||`代码块`)}</span><button type="button" data-copy-code>复制</button></div><pre><code>${n?e:on(e)}</code></pre></div>`},link(e){return`<a href="${on(e.href||``)}"${e.title?` title="${on(e.title)}"`:``} target="_blank" rel="noopener noreferrer">${this.parser.parseInline(e.tokens??[])}</a>`}}});function cn(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 ln(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=cn(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}var un=new Map,dn=160,fn=``,pn=``;function mn(e){if(fn!==``&&e===fn)return pn;let t=un.get(e);if(t!==void 0)return fn=e,pn=t,t;let n=sn.parse(e,{async:!1}),r=ln(an.sanitize(n,{ADD_ATTR:[`target`,`data-hint`,`data-hint-fit`]}));if(!(fn!==``&&e.startsWith(fn))){if(un.size>=dn){let e=un.keys().next().value;e!==void 0&&un.delete(e)}un.set(e,r)}return fn=e,pn=r,r}export{mn as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,t,u as n}from"./app-config.DkyjuL-S.js";var r=[`内置插件`,`测试技能`,`需求管理`,`生成能力`,`记忆与检索`,`待办与效率`,`人生管理`,`项目管理`,`仪表盘`,`开发工具`],i=[{id:`cases`,category:`测试技能`,name:`用例管理`,description:`侧栏进入用例库:浏览、搜索、打开与删除用例。关闭后入口隐藏,「生成测试用例」一并关闭;磁盘文件仍保留。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1},{id:`caseGen`,category:`测试技能`,name:`生成测试用例`,description:`在工作台用「/」打开配置:选类型、模板与提示词后生成用例并写入用例库。需同时开启「用例管理」。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1,hasPanel:!0,requires:`cases`},{id:`prompts`,category:`内置插件`,name:`提示词管理`,description:`侧栏进入提示词库:浏览、搜索、打开与删除提示词,并维护当前空间的「默认提示词」。每个空间都需要,属于内置能力,常开且没有开关。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!0,alwaysOn:!0},{id:`promptGen`,category:`内置插件`,name:`生成提示词`,description:`用「/」打开配置后对话生成提示词;质检通过后写入提示词库。属于内置能力,默认常开、没有开关。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!0,alwaysOn:!0,hasPanel:!0,requires:`prompts`},{id:`knowledgeLib`,category:`测试技能`,name:`知识库管理`,description:`侧栏进入知识库:浏览、搜索、打开与删除文档。关闭后入口隐藏,「生成知识库」一并关闭;磁盘文件仍保留。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1},{id:`knowledgeGen`,category:`测试技能`,name:`生成知识库`,description:`用「/」打开配置后对话生成规范、方法论或环境约定;质检通过后写入知识库。需同时开启「知识库管理」。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1,hasPanel:!0,requires:`knowledgeLib`},{id:`requirements`,category:`需求管理`,name:`需求文档库`,description:`侧栏进入需求文档库:浏览、搜索、上传与整理需求文档。关闭后入口隐藏;磁盘文件仍保留,生成用例时也不再引用。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1},{id:`templates`,category:`测试技能`,name:`测试模板库`,description:`侧栏进入测试模板库:浏览、上传与整理用例 / 报告模板。关闭后入口隐藏;磁盘文件仍保留,生成用例时不再选用模板。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1},{id:`testReports`,category:`测试技能`,name:`报告管理`,description:`侧栏进入报告库:按功能 / 接口 / 性能归档测试报告,可挂载提示词并在会话中打开修改。关闭后入口隐藏;磁盘文件仍保留。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1},{id:`knowledge`,category:`记忆与检索`,name:`知识库检索`,description:`工作台输入「@」引用知识库与模板文档;发送后由模型按需读取。关闭后 @ 只列工作区文件。`,version:`1.4.0`,requiresDev:!1,defaultEnabled:!1},{id:`memory`,category:`记忆与检索`,name:`会话记忆`,description:`五轨记忆(用户档案 / 全局事实 / 项目关键 / 项目日志 / 每日):待确认、归档与便签,在工作台「记忆」Tab 管理。`,version:`2.0.0`,requiresDev:!0,defaultEnabled:!1},{id:`todos`,category:`待办与效率`,name:`待办事项`,description:`侧栏进入待办事项:按状态 / 紧急程度筛选、行内改状态与手动维护;工作台会话也能通过工具直接记录与更新同一份待办。关闭后入口隐藏,磁盘数据仍保留。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1},{id:`tasks`,category:`待办与效率`,name:`任务管理`,description:`侧栏进入任务列表:按任务池 / 进行中 / 已完成 / 已关闭 / 已取消跟踪任务,并汇总每个任务下关联待办的数量与完成进度。关闭后入口隐藏,磁盘数据仍保留。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1},{id:`reports`,category:`待办与效率`,name:`工作汇报`,description:`打开后在工作台注入「工作汇报提示词」,并把这份提示词写进提示词管理,方便随时修改;关闭时只停用,提示词文件保留。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1},{id:`projects`,category:`项目管理`,name:`项目列表`,description:`侧栏进入项目列表:进度 / 规划 / 归档三种状态的项目卡片,汇总每个项目下的迭代、需求与缺陷数量;支持搜索、归档与删除。关闭后入口隐藏,数据仍保留。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1},{id:`iterations`,category:`项目管理`,name:`迭代管理`,description:`侧栏进入迭代管理:按项目维护迭代的开始 / 截止日期与状态,按日期流逝算进度并标出逾期。需同时开启「项目列表」。关闭后入口隐藏,数据仍保留。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1,requires:`projects`},{id:`pmRequirements`,category:`项目管理`,name:`需求管理`,description:`侧栏进入需求管理:按项目 / 迭代维护需求编号、优先级、状态与验收标准;需求挂在项目下,可关联迭代。需同时开启「项目列表」。关闭后入口隐藏,数据仍保留。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1,requires:`projects`},{id:`bugs`,category:`项目管理`,name:`缺陷管理`,description:`侧栏进入缺陷管理:按项目 / 迭代 / 需求记录缺陷,含严重程度、状态、重现步骤、期望与实际结果;关闭后入口隐藏,数据仍保留。需同时开启「项目列表」。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1,requires:`projects`},{id:`testStats`,category:`测试技能`,name:`测试统计`,description:`侧栏进入测试统计:按统计日期与测试统计维度(功能用例 / 自动化用例 / 接口用例 / 测试报告 / 缺陷统计等)记录统计数量,维度可搜索 / 创建 / 重命名 / 删除,下拉按创建时间倒序。打开开关即在当前空间生成 测试统计/测试统计.json。关闭后入口隐藏,磁盘数据仍保留。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1},{id:`caseExec`,category:`测试技能`,name:`用例执行统计`,description:`侧栏进入用例执行统计:每个项目一张卡片,卡头是项目名称与开始 / 结束日期,并显示该项目的基线、累计已执行与执行率进度条;卡内按统计日期逐行记录用例总数与待执行数量,自动算出已执行用例、当前剩余用例与执行比例(比例按项目累计口径:以该项目第一条记录的用例总数为基线)。项目名称可搜索或直接创建,按创建时间倒序,下拉里可重命名(同步改记录)或删除未被引用的名称;卡头改周期会写穿该项目全部记录。打开开关即在当前空间生成 用例执行统计/用例执行统计.json。关闭后入口隐藏,磁盘数据仍保留。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1},{id:`uiAuto`,category:`测试技能`,name:`自动化测试`,description:`侧栏出现「自动化项目」「自动化执行」两个入口:项目页管理已挂载 / 生成的项目,并能用固定模板从零生成 Playwright + TypeScript 企业级基础框架(生成前先做结构与选项体检,再按「自动化项目提示词」让 AI 审一遍骨架并给出可选补全,预览文件清单、自动挂载、不覆盖非空目录);执行页把已有的 Playwright / pytest / Selenium 项目挂进来(系统原生选目录,自动识别框架),一键运行 / 停止用例(先跑全量),实时看日志,查看 HTML 报告与结构化结果。执行的是目标项目自己的测试命令,不会自动安装依赖或联网。打开开关时在「提示词管理」生成两份提示词:「自动化执行提示词.md」(生成用例用)与「自动化项目提示词.md」(创建项目时的骨架体检用),已存在不覆盖,插件开启期间不可删除;旧的 Playwright提示词.md 会自动改名为前者,正文不动。关闭后两个入口一起隐藏,项目记录与报告仍保留。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1},{id:`reqAnalysis`,category:`需求管理`,name:`需求分析`,description:`侧栏进入需求分析:选「需求文档库」里的原始需求,用当前模型拆成结构化用户故事(角色 / 前置 / 主流程 / 替代 / 异常 / 后置 / 验收),可编辑、可导出 Markdown;打开时默认一并开启「用户故事审查」,生成用户故事成功后自动审查。打开开关时在「提示词管理」生成「需求分析提示词.md」和「原文结构提示词.md」(已存在不覆盖,插件开启期间不可删除)。关闭后入口隐藏,已保存的分析仍保留。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1},{id:`storyReview`,category:`需求管理`,name:`用户故事审查`,description:`打开后不新增侧栏入口:在「需求分析」页多出「审查结果」Tab;生成用户故事成功后自动初审,结果页可「重新审查 / 重新全量扫描」。先用固定规则核对覆盖率,再让模型专查场景遗漏与待确认项,缺口可勾选补写、可导出 Markdown。开启「需求分析」时默认一并打开,也可单独关掉。打开开关时在「提示词管理」生成「用户故事审查提示词.md」(已存在不覆盖,插件开启期间不可删除)。关闭后这些入口隐藏,审查结果仍保留在分析里。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!0,requires:`reqAnalysis`,autoEnableWith:`reqAnalysis`},{id:`testPoints`,category:`需求管理`,name:`生成测试点`,description:`打开后不新增侧栏入口:在「需求分析」页里多出「生成测试点」按钮与「测试点」Tab,基于拆好的用户故事按功能 / 边界值 / 异常 / 业务规则 / 非功能五个维度拆测试点,每条标注 P0–P3 优先级;界面与导出按 Ideal「一行一条」需求标题 → 五维 → 测试点归组(列表 / 左右导图 / XMind 向右逻辑图骨架,样式与原文结构导出一致 / Markdown),可下载。开启「需求分析」时默认一并打开,也可单独关掉。打开开关时在「提示词管理」生成「测试点生成提示词.md」(已存在不覆盖,插件开启期间不可删除)。关闭后这些入口隐藏,已生成的测试点仍保留在分析里。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!0,requires:`reqAnalysis`,autoEnableWith:`reqAnalysis`},{id:`caseReview`,category:`测试技能`,name:`用例质量评审`,description:`打开后不新增侧栏入口:在「用例管理」文件行上多出「评审」按钮与评审列,打开抽屉对整份用例做分级质检——逐条判定可用 / 待修改 / 错误无效,五维打分(需求覆盖 / 步骤可执行 / 预期可判定 / 数据与边界 / 规范完整),另给七项量化指标与逐条扣分原因、改进建议;报告可导出 Markdown。开启「用例管理」时默认一并打开,也可单独关掉。打开开关时在「提示词管理」生成「用例质量评审提示词.md」(已存在不覆盖,插件开启期间不可删除)。关闭后入口隐藏,评审结果仍保留。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1,requires:`cases`,autoEnableWith:`cases`},{id:`caseBlindspot`,category:`测试技能`,name:`场景遗漏补全`,description:`打开后不新增侧栏入口:在「用例管理」的评审抽屉里多出「场景补全」Tab,专挖人工最容易漏的场景——非功能 / 安全边界与容错 / 兼容性 / 隐藏业务规则,逐条给出为什么容易漏与建议用例;勾选后跳到这条用例绑定的工作台会话,由模型按文件表头补进原用例文件(写前自动备份)。可根据文件名自动挂上对照需求。开启「用例管理」时默认一并打开,也可单独关掉。打开开关时在「提示词管理」生成「场景遗漏补全提示词.md」(已存在不覆盖,插件开启期间不可删除)。关闭后入口隐藏,探测结果仍保留。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1,requires:`cases`,autoEnableWith:`cases`},{id:`life`,category:`人生管理`,name:`人生管理`,description:`侧栏进入人生管理六张表:KR 待办、KR 任务、Objective 目标、OKR 复盘、年度计划、人生阶段。数据落在当前空间各自目录,与待办事项 / 任务管理互不关联。关闭后入口隐藏,磁盘数据仍保留。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1},{id:`dashboard`,category:`仪表盘`,name:`仪表盘`,description:`侧栏进入仪表盘:把当前空间的待办、任务、项目与测试统计聚合成一页(指标卡、倒计时、今日待办、进行中任务、测试统计柱状图、飞书式待办日历)。首次打开是空白画布,需在「编辑组件」里自行添加卡片;待办 / 任务为表格 + 分页。卡片摆在 12 列自由画布上,按住顶部圆点手柄拖位置、拖右下角把手改宽高,挡住相邻卡片时松手把它们挤开或让位;布局按空间记在浏览器本地。关闭后入口隐藏,数据仍保留。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1},{id:`pluginDev`,category:`开发工具`,name:`插件开发`,description:`用固定提示词开发扩展插件:先评估形态与范围并用选项确认,确认后才改代码,完成后并入「扩展插件」。需要读写项目源码。`,version:`0.1.0`,requiresDev:!0,defaultEnabled:!1,hasPanel:!0}];function a(e=i){return r.map(t=>({category:t,items:e.filter(e=>e.category===t)})).filter(e=>e.items.length>0)}var o=`tw-plugins-changed`;function s(){let e={};for(let t of i)e[t.id]=t.defaultEnabled;return e}function c(e,t){let n={...e};if(t&&!m(t.id)?.alwaysOn){if(n[t.id]=t.enabled,t.enabled){let e=m(t.id)?.requires;e&&(n[e]=!0);for(let e of i)e.autoEnableWith===t.id&&(n[e.id]=!0)}else for(let e of i)e.requires===t.id&&(n[e.id]=!1)}for(let e of i)e.alwaysOn&&(n[e.id]=!0);for(let e of i)e.requires&&!n[e.requires]&&(n[e.id]=!1);return n}function l(){let t=s(),n=e().plugins??{};for(let e of i)typeof n[e.id]==`boolean`&&(t[e.id]=n[e.id]);return c(t)}function u(e){return l()[e]}function d(e){let t=s();for(let n of i)typeof e[n.id]==`boolean`&&(t[n.id]=e[n.id]);return c(t)}function f(e,r){if(m(e)?.alwaysOn)return l();let i=c(l(),{id:e,enabled:r});return n({plugins:i}),t(),typeof window<`u`&&window.dispatchEvent(new CustomEvent(o,{detail:i})),i}function p(e){if(typeof window>`u`)return()=>{};let t=t=>{let n=t.detail;e(n??l())};return window.addEventListener(o,t),()=>{window.removeEventListener(o,t)}}function m(e){return i.find(t=>t.id===e)}function h(e){let t=m(e),n=t?.name??e;return t?.requires&&!u(t.requires)?`请先在「我的插件」中启用「${m(t.requires)?.name??t.requires}」`:`请先在「我的插件」中启用「${n}」`}export{l as a,d as c,u as i,f as l,m as n,p as o,a as r,h as s,i as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e){return e===`requirements`?`/__tb_requirements`:e===`cases`?`/__tb_cases`:e===`prompts`?`/__tb_prompts`:e===`knowledge`?`/__tb_knowledge`:e===`testReports`?`/__tb_test_reports`:`/__tb_templates`}async function t(t,n,r){let i=await fetch(`${e(t)}${n}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r??{})}),a=await i.json();if(!i.ok)throw Error(a.error||`HTTP ${i.status}`);return a}async function n(t){try{return(await fetch(`${e(t)}/health`,{signal:AbortSignal.timeout(1500)})).ok}catch{return!1}}async function r(e,n=`.`){let r=await t(e,`/list`,{path:n});return{path:r.path,entries:r.entries??[]}}function i(e){return e.startsWith(`~$`)||e.startsWith(`~WRL`)||e.startsWith(`.~lock.`)}async function a(t){let n=await fetch(`${e(t)}/tree`,{signal:AbortSignal.timeout(3e3)}),r=await n.json();if(!n.ok)throw Error(r.error||`HTTP ${n.status}`);return{tree:r.tree??[],totalFiles:r.totalFiles??0}}async function o(e,n,r){return(await t(e,`/mkdir`,{parent:n,name:r})).path}async function s(e,n,r){let i=await r.arrayBuffer(),a=new Uint8Array(i),o=``;for(let e=0;e<a.length;e++)o+=String.fromCharCode(a[e]);let s=btoa(o);return t(e,`/upload`,{parent:n,name:r.name,contentBase64:s})}async function c(e,n){let r=await t(e,`/read`,{path:n});if(r.encoding===`utf-8`&&typeof r.content==`string`)return{path:r.path,content:r.content,encoding:r.encoding};throw Error(`该文件不是可预览的文本`)}async function l(e,n){let r=await t(e,`/read`,{path:n});if(r.encoding===`utf-8`&&typeof r.content==`string`)return{path:r.path,encoding:`utf-8`,content:r.content};if(typeof r.contentBase64==`string`)return{path:r.path,encoding:`base64`,contentBase64:r.contentBase64};throw Error(`无法读取文件`)}async function u(e,n,r){await t(e,`/write-text`,{path:n,content:r})}async function d(e,n,r){await t(e,`/write-binary`,{path:n,contentBase64:r})}async function f(e,n){await t(e,`/delete`,{path:n})}async function p(e,n,r){return(await t(e,`/rename`,{path:n,name:r})).path}function m(e){let t=e.lastIndexOf(`/`);return t<0?`.`:e.slice(0,t)}function h(e,t){return e===t||e.startsWith(`${t}/`)}function g(e,t,n){return h(e,t)?n+e.slice(t.length):e}function _(e,t){for(let n of e){if(n.path===t)return n;let e=_(n.children,t);if(e)return e}return null}function v(e){let t=0;for(let n of e.children)t+=1+v(n);return t}async function y(e,n){await t(e,`/open`,{path:n})}export{d as _,_ as a,r as c,m as d,l as f,s as g,p as h,a as i,o as l,g as m,f as n,i as o,c as p,n as r,h as s,v as t,y as u,u as v};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var e=`默认提示词.md`,t=[`空间提示词.md`,`空间默认提示词.md`,`系统提示词.md`,`AI工作台系统提示词.md`],n=`你是 Lantern Harness 的 AI 助手,协助思考、写作、分析、编程与日常工作。
|
|
2
|
-
`,r={"工作汇报提示词.md":`reports`,"自动化执行提示词.md":`uiAuto`,"自动化项目提示词.md":`uiAuto`,"需求分析提示词.md":`reqAnalysis`,"原文结构提示词.md":`reqAnalysis`,"用户故事审查提示词.md":`storyReview`,"测试点生成提示词.md":`testPoints`,"用例质量评审提示词.md":`caseReview`,"场景遗漏补全提示词.md":`caseBlindspot`,"功能测试报告提示词.md":`testReports`,"接口测试报告提示词.md":`testReports`,"性能测试报告提示词.md":`testReports`},i={"自动化执行提示词.md":`generate`,"自动化项目提示词.md":`scaffold`},a={"自动化执行提示词.md":`自动化执行`,"自动化项目提示词.md":`自动化项目`},o=new Set([e,...t]);function s(e){let t=e.split(`/`).pop()??e;return o.has(t)}function c(e){return r[e.split(`/`).pop()??e]}function l(e,t){let n=c(e);return n&&t?t[n]===!0:!1}function u(e,t){return s(e)||l(e,t)}function d(e){return(e||``).replace(/\\/g,`/`).replace(/^\.\//,``).trim()}function f(e){return i[e.split(`/`).pop()??e]??``}function p(e){return a[e.split(`/`).pop()??e]??``}function m(e,t){return t?!!t[d(e)]:!1}function h(e,t){let n=e.split(`/`).pop()??e;return s(n)?`system`:c(n)||(t?t[d(e)]??``:``)}function g(e,t){if(s(e))return`默认提示词不可删除`;let n=c(e);return n&&t?.[n]?`插件开启中,这份提示词由插件自带并维护;先在「我的插件」里关闭对应插件再删除`:``}function _(e){return s(e.split(`/`).pop()??e)}export{u as a,d as c,h as d,c as f,l as i,g as l,n,m as o,f as p,_ as r,s,e as t,p as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=`/__tb_reports`,t={day:`日报`,week:`周报`,month:`月报`};async function n(t){let n=await fetch(`${e}/sync`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:t})});if(!n.ok)throw Error(`同步工作汇报提示词失败(${n.status})`);return await n.json()}async function r(){let t=await fetch(`${e}/state`,{signal:AbortSignal.timeout(3e3)});if(!t.ok)throw Error(`读取工作汇报状态失败(${t.status})`);return await t.json()}async function i(){let t=await fetch(`${e}/prompts`,{signal:AbortSignal.timeout(3e3)});if(!t.ok)throw Error(`读取提示词列表失败(${t.status})`);return await t.json()}async function a(t){let n=await fetch(`${e}/select`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({file:t})});if(!n.ok)throw Error(`切换提示词失败(${n.status})`);let r=await n.json();return typeof r.promptFile==`string`?r.promptFile:t}async function o(){let t=await fetch(`${e}/prompt`,{signal:AbortSignal.timeout(2e3)});if(!t.ok)return``;let n=await t.json();return typeof n.content==`string`?n.content.trim():``}async function s(t){let n=await fetch(`${e}/list?kind=${t}`,{signal:AbortSignal.timeout(4e3)});if(!n.ok)throw Error(`读取汇报列表失败(${n.status})`);return await n.json()}async function c(t,n){let r=await fetch(`${e}/open`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:t,name:n}),signal:AbortSignal.timeout(4e3)});if(r.ok)return;let i=`打开失败(${r.status})`;try{let e=((await r.json()).error??``).trim();e&&/^not found$/i.test(e)?i=`本地服务版本较旧(缺少「打开文件」接口),请重启本地服务后再试`:e&&(i=e)}catch{}throw Error(i)}async function l(t,n){let r=await fetch(`${e}/delete`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:t,names:n}),signal:AbortSignal.timeout(8e3)}),i={};try{i=await r.json()}catch{}if(!r.ok){let e=(i.error??``).trim();throw e&&/^not found$/i.test(e)?Error(`本地服务版本较旧(缺少「删除汇报」接口),请重启本地服务后再试`):Error(e||`删除失败(${r.status})`)}return{ok:!0,kind:t,deleted:Array.isArray(i.deleted)?i.deleted:[],missing:Array.isArray(i.missing)?i.missing:[]}}export{i as a,a as c,r as i,n as l,l as n,s as o,o as r,c as s,t};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_astro/jszip.min.Bh2Mgo40.js","_astro/react.Blvh0GOs.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{s as e}from"./react.Blvh0GOs.js";import{t}from"./app-version.3eY3FSw1.js";import{b as n}from"./settings.38J2uD5M.js";var r=`org.xmind.ui.logic.right`,i=`org.xmind.topicShape.roundedRect`,a=`org.xmind.branchConnection.elbow`,o=`#94a3b8`,s=`#d0d5dd`,c=`#1c3d5a`;function l(e,t){let n=2166136261;for(let e=0;e<t.length;e++)n^=t.charCodeAt(e),n=Math.imul(n,16777619);let r=(n>>>0).toString(36),i=t.replace(/[^A-Za-z0-9_-]/g,``).slice(0,24);return i?`${e}-${i}-${r}`:`${e}-${r}`}function u(e,t){return{id:l(`st`,`${i}-${e}-${t}`),properties:{"shape-class":i,"line-class":a,"line-color":o,"line-width":`1`,"svg:fill":e,"fo:color":t,"border-line-color":s,"border-line-width":`1`}}}var d=u(`#1c3d5a`,`#ffffff`),f=u(`#3370ff`,`#ffffff`),ee=u(`#ffffff`,c);function te(){let e=(e,t)=>({properties:{"shape-class":i,"line-class":a,"line-color":o,"line-width":`1`,"svg:fill":e,"fo:color":t,"border-line-color":s,"border-line-width":`1`}});return{centralTopic:e(`#1c3d5a`,`#ffffff`),mainTopic:e(`#3370ff`,`#ffffff`),subTopic:{properties:{"line-class":a,"svg:fill":`#ffffff`,"fo:color":c,"line-color":o,"line-width":`1`}},map:{properties:{"svg:fill":`#ffffff`,"line-color":o}}}}async function ne(r){let{default:i}=await n(async()=>{let{default:t}=await import(`./jszip.min.Bh2Mgo40.js`).then(t=>e(t.t(),1));return{default:t}},__vite__mapDeps([0,1])),a=new i;a.file(`content.json`,JSON.stringify(r));let o=Array.isArray(r)?r:[],s=o[0]&&typeof o[0]==`object`&&o[0].id||`sheet-1`;return a.file(`metadata.json`,JSON.stringify({creator:{name:`Lantern Harness`,version:t},activeSheetId:s})),a.file(`manifest.json`,JSON.stringify({"file-entries":{"content.json":{},"metadata.json":{}}})),a.generateAsync({type:`blob`,compression:`DEFLATE`})}function p(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),URL.revokeObjectURL(n)}var m=`/__tb_reqanalysis`,h=`需求分析提示词.md`,re=`原文结构提示词.md`,ie=`需求分析`,ae=12e3,oe=2e4,se={draft:{label:`待拆解`,tone:`gray`},decomposed:{label:`已拆解`,tone:`blue`},checked:{label:`已审查`,tone:`amber`},accepted:{label:`已验收`,tone:`green`}},ce={P0:`red`,P1:`amber`,P2:`gray`},le={"uncovered-outline":`待确认·未覆盖`,"pending-confirm":`待确认`,"missing-field":`字段缺失`,"missing-scenario":`场景遗漏`,"missing-dimension":`维度缺失`,"untestable-acceptance":`验收不可测`,conflict:`与原文冲突`,"over-split":`过度拆分`,other:`其它`},ue=new Set([`uncovered-outline`,`pending-confirm`,`conflict`,`other`]);function de(e){return ue.has(e.type)}function fe(e){return e.filter(de)}var pe={high:`高`,medium:`中`,low:`低`},me={high:`red`,medium:`amber`,low:`gray`},he=[{key:`permission`,label:`权限与角色`,keywords:[`权限`,`角色`,`授权`,`越权`,`未登录`,`登录`,`管理员`,`普通用户`],hint:`补充不同角色 / 未登录 / 越权访问时这条流程的行为。`},{key:`boundary`,label:`边界值`,keywords:[`边界`,`上限`,`下限`,`最大`,`最小`,`长度`,`超长`,`字数`,`为空`,`空值`],hint:`补充字段长度、数量上限、刚好等于阈值时的表现。`},{key:`concurrency`,label:`并发与幂等`,keywords:[`并发`,`重复`,`幂等`,`同时`,`加锁`,`冲突`,`重复提交`],hint:`补充重复提交、多人同时操作同一数据时的结果。`},{key:`empty`,label:`空数据`,keywords:[`空数据`,`无数据`,`没有数据`,`空列表`,`暂无`,`空态`],hint:`补充列表为空、首次使用、数据被清空时的空态。`},{key:`failure`,label:`超时与失败`,keywords:[`超时`,`失败`,`异常`,`错误`,`重试`,`断网`,`不可用`,`降级`,`回滚`],hint:`补充依赖超时、接口失败、网络中断时的提示与回滚。`},{key:`i18n`,label:`国际化与时区`,keywords:[`国际化`,`时区`,`多语言`,`语言`,`翻译`,`utc`,`夏令时`],hint:`补充跨时区时间展示、多语言文案与本地化格式。`}],ge=/创建|新增|新建|保存|提交|删除|编辑|修改|更新|上传|导入|导出|发布|审批|撤回|绑定|解绑|发送|支付|下单|配置|启停|启用|停用/;async function g(e,t){let n=await fetch(`${m}${e}`,{...t,headers:t?.body===void 0?void 0:{"Content-Type":`application/json`,...t?.headers}}),r=await n.json().catch(()=>({}));if(!n.ok||r.ok===!1)throw Error(r.error||`HTTP ${n.status}`);return r}async function _e(){try{return(await fetch(`${m}?health=1`,{signal:AbortSignal.timeout(1500)})).ok}catch{return!1}}async function ve(){return(await g(`/list`)).docs??[]}async function ye(e){return(await g(`/create`,{method:`POST`,body:JSON.stringify(e)})).doc}async function be(e,t){return(await g(`/`,{method:`PUT`,body:JSON.stringify({id:e,...t})})).doc}async function xe(e){await g(`/delete`,{method:`POST`,body:JSON.stringify({id:e})})}async function Se(){try{let e=await g(`/prompt`),t=e.decompose??``,n=e.stories??``;return{file:e.file||`需求分析提示词.md`,exists:e.exists===!0,decompose:t,stories:n||t,structure:e.structure??``,audit:e.audit??``,fix:e.fix??``}}catch(e){return{file:h,exists:!1,decompose:``,stories:``,structure:``,audit:``,fix:``,error:e instanceof Error?e.message:String(e)}}}async function Ce(e){return await g(`/prompt/sync`,{method:`POST`,body:JSON.stringify({enabled:e})})}async function we(e){return(await De(e)).content}async function Te(e,t=oe){try{let n=(await we(e)).trim();return{text:n.slice(0,t),total:n.length,truncated:n.length>t}}catch{return{text:``,total:0,truncated:!1}}}async function Ee(){return(await g(`/sources`)).files??[]}async function De(e){return g(`/source?path=${encodeURIComponent(e)}`)}var Oe=/[\s\p{P}\p{S}]+/gu;function _(e){return String(e??``).toLowerCase().replace(Oe,``)}function v(e){return Array.from(new Set(e.map(e=>String(e??``).trim()).filter(Boolean)))}function y(e,t=500){return typeof e==`string`?e.trim().slice(0,t):``}function b(e,t=30,n=500){return Array.isArray(e)?e.map(e=>y(e,n)).filter(Boolean).slice(0,t):[]}function ke(e){let t=2166136261,n=String(e??``);for(let e=0;e<n.length;e++)t^=n.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,`0`)}function Ae(e){return ke(String(e??``))}function x(e,t=80){return String(e??``).replace(/\s+/g,` `).trim().slice(0,t)}function S(e){let t=String(e.sourceTitle||e.sourcePath||``).trim();if(t){let e=t.split(/[/\\]/).pop()?.trim();if(e)return e}return String(e.title||``).trim()||`未命名文档`}function je(e){return x((String(e??``).split(/[/\\]/).pop()?.replace(/\.[^.]+$/,``).trim()||``).replace(/_?需求文档$/u,``).replace(/_?需求说明$/u,``).replace(/_?需求$/u,``).trim())||`未命名需求`}function C(e){return String(e.sourceTitle||e.title||``).trim()||je(e.sourcePath)}function Me(e){let t=String(e??``).split(/[/\\]/).pop()?.trim()||``;return t=t.replace(/\.(xlsx|xls|docx|doc|md|txt|csv)$/i,``),t.replace(/_?需求文档$/u,``).replace(/_?需求说明$/u,``).replace(/_?需求$/u,``).replace(/迭代版本$/u,``).replace(/版本$/u,``).trim()}function Ne(e){let t=Me(e);return t=t.replace(/v?\d+(?:\.\d+)*/gi,``),t.replace(/[\s_\-—·()()[\]【】]+/gu,``).toLowerCase()}function w(e){let t=Me(e),n=/v(\d+(?:\.\d+)*)/i.exec(t)||/(\d+(?:\.\d+)+)/.exec(t);return n?.[1]?n[1].split(`.`).map(e=>{let t=Number(e);return Number.isFinite(t)?t:0}):null}function Pe(e,t){let n=Math.max(e.length,t.length);for(let r=0;r<n;r++){let n=e[r]??0,i=t[r]??0;if(n!==i)return n-i}return 0}function Fe(e,t){let n=C(e),r=Ne(n),i=w(n);return!r||!i?[]:t.filter(t=>{if(t.id===e.id)return!1;let n=C(t);if(Ne(n)!==r)return!1;let a=w(n);return a?Pe(a,i)<0:!1}).sort((e,t)=>Pe(w(C(e))??[],w(C(t))??[]))}function Ie(e){let t=[];for(let n of e){let e=C(n);for(let r of B(n.outline))t.push({docId:n.id,docLabel:e,point:r})}return t}function Le(e){let t=String(e??``).toLowerCase().replace(/\s+/g,` `).trim();if(!t)return[];let n=[];for(let e of t.matchAll(/[a-z0-9_]{2,}|[\u4e00-\u9fff]{2}/gu))n.push(e[0]);let r=t.replace(/[^\u4e00-\u9fff]/g,``);for(let e=0;e<r.length-1;e++)n.push(r.slice(e,e+2));return[...new Set(n)].slice(0,80)}var Re=40,ze=7e3;function Be(e,t,n){if(!t.length)return[];let r=Math.max(1,n?.maxItems??Re),i=Math.max(200,n?.maxChars??ze),a=Le(e),o=String(e??``).toLowerCase();if(!a.length&&!o.trim())return[];let s=[];for(let e of t){let t=e.point.title||``,n=(e.point.quote||e.point.body||``).slice(0,200),r=0;t&&o.includes(t.toLowerCase())&&(r+=8),n&&n.length>=4&&o.includes(n.toLowerCase().slice(0,40))&&(r+=5);let i=Le(`${t} ${n}`);for(let e of i)a.includes(e)&&(r+=e.length>=3?2:1);r<=0||s.push({...e,score:r})}s.sort((e,t)=>t.score-e.score||e.docLabel.localeCompare(t.docLabel,`zh`)||e.point.id.localeCompare(t.point.id));let c=[],l=0;for(let e of s){if(c.length>=r)break;let t=Ve(e);if(c.length>0&&l+t.length+1>i)break;c.push(e),l+=t.length+1}return c}function Ve(e){let t=e.point.kind===`query`?`查询`:e.point.kind===`mutate`?`修改`:`子点`,n=(e.point.quote||e.point.body||``).replace(/\s+/g,` `).trim().slice(0,120);return`- [${e.docLabel}] ${e.point.id} [${t}] ${e.point.title}${n?`(${n})`:``}`}function He(e){return e.length?[`## 历史迭代需求条目(检索参考,勿当作本版文档条目 id)`,`来源版本:${[...new Set(e.map(e=>e.docLabel))].join(`、`)}。下列 id 属于历史分析,禁止写入本版 sourceRefs;仅作能力对照与延伸参考。`,...e.map(Ve)].join(`
|
|
3
|
-
`):``}function Ue(e,t){if(!e?.length)return[];let n=new Map(t.map(e=>[e.id,e])),r=[];for(let t of e){let e=n.get(t);e&&B(e.outline).length&&r.push(e)}return r}function We(e){let t=String(e??``).trim();return t?!!(/^"+,{2,}/.test(t)||/^,{2,}/.test(t)&&/(待开发|已开发|需求\s*,\s*高|v\d+\.\d+)/.test(t)||!/【/.test(t)&&!/^\d+[、.]/.test(t)&&/,/.test(t)&&/(待开发|已关闭|已完成|需求\s*,\s*[高低中]|v\d+\.\d+|^\d{4}年\d{1,2}月)/.test(t)):!1}function Ge(e){let t=String(e??``),n=t.search(/"\s*,{2,}/);n>=0&&(t=t.slice(0,n));let r=t.split(`
|
|
4
|
-
`),i=[];for(let e of r){if(We(e))break;let t=e.search(/"\s*,{2,}/);if(t>=0){i.push(e.slice(0,t));break}i.push(e)}return i.join(`
|
|
5
|
-
`).replace(/^"/,``).replace(/"$/,``).trim()}function Ke(e){let t=Ge(e.body).slice(0,4e3),n=x(t.match(/【([^】\n]{1,40})】/)?.[1]||e.title||e.small);return{...e,title:n||e.small,body:t||`【${n||e.small}】`}}function T(e){return String(e??``).toLowerCase().replace(/[\s\p{P}\p{S}]+/gu,``)}function qe(e){let t=[],n=[],r=``,i=!1,a=!0;for(let o=0;o<e.length;o+=1){let s=e[o];i?s===`"`?e[o+1]===`"`?(r+=`"`,o+=1):i=!1:r+=s:s===`"`&&a?(i=!0,a=!1):s===`,`?(n.push(r),r=``,a=!0):s===`
|
|
6
|
-
`?(n.push(r),t.push(n),n=[],r=``,a=!0):(r+=s,a=!1)}return n.push(r),(n.length>1||n[0]!==``)&&t.push(n),t}function Je(e,t){let n=String(e??``).trim(),r=((n.startsWith(`【${t}】`)?n.slice(t.length+2).trim():n.replace(/^【[^】]{1,40}】/,``).trim()).split(`
|
|
7
|
-
`).find(e=>e.trim())??``).split(/[。;;::,,、\s]/)[0]?.trim()??``;return r.length>=2?x(r,14):``}function Ye(e){let t=new Set,n=new Map;return e.map(e=>{let r=e.title||e.small,i=T(r),a=(n.get(i)??0)+1;if(n.set(i,a),a===1&&!t.has(i))return t.add(i),e;let o=Je(e.body,r),s=a,c=x(o?`${r} · ${o}`:`${r}(${s})`);for(;t.has(T(c));)s+=1,c=x(o?`${r} · ${o}(${s})`:`${r}(${s})`);return t.add(T(c)),{...e,title:c}})}function E(e){return String(e??``).toLowerCase().replace(/[\s\u3000_//||·•]+/g,``).trim()}function D(e,t){let n=E(e);return n?t.some(e=>{let t=E(e);return t&&(n===t||n.includes(t))}):!1}function O(e,t){return e.findIndex(e=>D(e,t))}var k=[`大模块`,`大类`,`一级模块`,`模块分类`],A=[`小模块`,`功能点`,`需求点`,`二级模块`,`子模块`],Xe=[`优化/问题内容`,`优化问题内容`,`问题内容`,`需求描述`,`需求内容`,`需求说明`,`功能描述`,`描述`,`优化内容`],Ze=[`模块`,`功能模块`,`所属模块`],j=[`需求内容`,`需求点`,`功能点`,`需求说明`,`功能说明`],Qe=[`字段名称`,`字段类型`,`字段定义`,`校验规则`,`输入方式`];function $e(e){return e.split(`
|
|
8
|
-
`).map(e=>e.trim().replace(/^\|/,``).replace(/\|$/,``).split(/\s*\|\s*/).map(e=>e.trim())).filter(e=>e.length>=2&&e.some(e=>e))}function M(e){let t=O(e,k),n=O(e,A);return t>=0&&n>=0&&t!==n}function et(e){return Qe.filter(t=>e.some(e=>D(e,[t]))).length>=2||e.some(e=>D(e,[`字段名称`]))}function tt(e){if(et(e))return!1;let t=O(e,Ze),n=O(e,j);return!(t<0||n<0||t===n||M(e))}function nt(e){let t=e=>{let t=e.findIndex(M);return t<0?null:{headers:e[t],rows:e.slice(t+1)}};return t(qe(e))??t($e(e))}function N(e){let t=String(e??``).replace(/\r\n?/g,`
|
|
9
|
-
`).trim();if(!t)return[];let n=[];for(let e of t.split(/^(?=##\s+)/m)){let t=e.replace(/^##\s+.*\n?/,``);if(!k.some(e=>t.includes(e))||!A.some(e=>t.includes(e)))continue;let r=nt(t);if(!r)continue;let i=O(r.headers,k),a=O(r.headers,A),o=O(r.headers,Xe);o<0&&(o=Math.max(a,i)+1);for(let e of r.rows){let t=(e[i]??``).trim(),r=(e[a]??``).trim(),s=(e[o]??``).trim();r&&!D(r,A)&&(D(t,k)||/[。;;]/.test(r)||r.length>40||s&&n.push(Ke({big:t,small:r,title:r,body:s})))}}return Ye(n)}function P(e,t){let n=x(e),r=String(t??``).trim().slice(0,4e3)||n;return{title:n||e,body:r,quote:r.replace(/\s+/g,` `).slice(0,80)}}var F=`输入参数|输出参数|正常流程|扩展流程|补充说明|前置条件|优先级|提出人|附件|备注`,I=RegExp(`^(?:${F})$`),rt=RegExp(`(?:^|[||。;;\\s])(?:无\\s*)?(?:${F})(?=\\s*[||]|\\s*$)`);function it(e){let t=String(e??``).replace(/\r\n?/g,`
|
|
10
|
-
`).split(`
|
|
11
|
-
`),n=[],r=null,i=()=>{if(!r?.title){r=null;return}let e=[r.id&&`编号:${r.id}`,r.body].filter(Boolean).join(`
|
|
12
|
-
`);n.push(P(r.title,e||r.title)),r=null};for(let e of t){let t=e.trim();if(!t)continue;if(/^#{1,6}\s/.test(t)){i();continue}let n=t.match(/^([^||]{1,20})\s*[||]\s*(.*?)\s*$/);if(!n){r?.title&&t.length>4&&(r.body=r.body?`${r.body}\n${t}`:t);continue}let a=n[1].trim(),o=n[2].replace(/\s*[||]\s*$/,``).trim(),s=E(a);I.test(a)||I.test(s)?r?.title&&i():s===`编号`||s===`需求编号`||s===`功能编号`?(i(),r={title:``,body:``,id:o}):s===`功能名称`||s===`需求名称`||s===`功能点名称`?(r?.title&&i(),r??={title:``,body:``,id:``},r.title=o):(s===`功能描述`||s===`需求描述`||s===`功能说明`||s===`需求说明`)&&(r??={title:``,body:``,id:``},r.body=r.body?`${r.body}\n${o}`:o)}return i(),L(n)}function at(e,t){return e.length>=t?e.slice(0,t):[...Array(t-e.length).fill(``),...e]}function ot(e){let t=String(e??``).replace(/\r\n?/g,`
|
|
13
|
-
`).trim();if(!t)return[];let n=[],r=new Set,i=e=>{for(let t=0;t<e.length;t+=1){let i=e[t];if(!tt(i))continue;let a=i.map(E).join(`,`);if(r.has(a))continue;r.add(a);let o=O(i,Ze),s=O(i,j),c=``,l=t+1;for(;l<e.length;l+=1){let t=e[l];if(tt(t)||M(t)||et(t)||t.every(e=>!e.trim()))break;t=at(t,i.length);let r=(t[o]??``).trim(),a=(t[s]??``).trim();r?c=r:r=c;let u=a||r;if(!u||D(u,j)||/^(创建|修改|删除|优化|\d+(\.\d+)*)$/.test(u))continue;let d=a&&r&&a!==r?`${r} · ${a}`:u,f=a&&r?`【${r}】${a}`:u;n.push(P(d,f))}t=Math.max(t,l-1)}};return i(qe(t)),i($e(t)),L(n)}function L(e){let t=new Set,n=new Map;return e.map(e=>{let r=e.title,i=T(r),a=(n.get(i)??0)+1;if(n.set(i,a),a===1&&!t.has(i))return t.add(i),e;let o=Je(e.body,r),s=a,c=x(o?`${r} · ${o}`:`${r}(${s})`);for(;t.has(T(c));)s+=1,c=x(o?`${r} · ${o}(${s})`:`${r}(${s})`);return t.add(T(c)),{...e,title:c}})}function st(e){let t=N(e);if(t.length)return{schema:`ideal`,entries:t.map(e=>P(e.title||e.small,e.body||`【${e.title||e.small}】`))};let n=it(e);if(n.length>=3)return{schema:`feature-kv`,entries:n};let r=ot(e);return r.length>=3?{schema:`module-content`,entries:r}:n.length?{schema:`feature-kv`,entries:n}:r.length?{schema:`module-content`,entries:r}:null}function ct(e){let t=new Map,n=String(e??``).replace(/\r\n?/g,`
|
|
14
|
-
`),r=[...n.matchAll(/^(#{2,3})\s+\S/gm)].map(e=>e[1].length);if(!r.length)return t;let i=r.includes(3)?3:2,a=n.split(RegExp(`(?=^#{${i}}\\s+)`,`m`)).filter(e=>e.trim());for(let e of a){let n=e.match(RegExp(`^#{${i}}\\s+(.+?)\\s*$`,`m`));if(!n)continue;let r=x(n[1]??``);if(!r)continue;let a=e.replace(RegExp(`^#{${i}}\\s+.+?\\s*\\n?`),``).trim().slice(0,4e3);if(!a)continue;let o=T(r);t.has(o)||t.set(o,a);let s=r.replace(/^功能[-—–]\s*/,``).trim();if(s&&s!==r){let e=T(s);t.has(e)||t.set(e,a)}}return t}function R(e,t){let n=ct(t);return n.size?e.map(e=>{if((e.body||``).replace(/\s+/g,``).length>=40)return e;let t=[T(e.title),T(e.title.split(` · `)[0]??``),T(e.title.replace(/^【[^】]+】/,``))].filter(Boolean);for(let r of t){let t=n.get(r);if(!t)continue;let i=`${e.body}\n\n${t}`.trim().slice(0,4e3);return{...e,body:i,quote:i.replace(/\s+/g,` `).slice(0,80)}}return e}):e}function lt(e){let t=String(e??``).replace(/\r\n/g,`
|
|
15
|
-
`).trim();if(!t)return[];let n=[],r=/^(概述|简介|目录|修订|附录|背景|术语|参考|全局性说明|文档修订|需求确认)/,i=[...t.matchAll(/^(#{2,3})\s+\S/gm)].map(e=>e[1].length).includes(3)?3:2,a=t.split(RegExp(`(?=^#{${i}}\\s+)`,`m`)).filter(e=>e.trim());if(a.length>1||RegExp(`^#{${i}}\\s+`,`m`).test(t))for(let e of a){let t=e.match(RegExp(`^#{${i}}\\s+(.+?)\\s*$`,`m`));if(!t)continue;let a=x(t[1]??``);if(!a||a.length>40||r.test(a))continue;let o=e.replace(RegExp(`^#{${i}}\\s+.+?\\s*\\n?`),``).trim().slice(0,4e3);(o||!n.some(e=>e.title===a))&&n.push(P(a,o||a))}return n}function ut(e){let t=st(e);if(t&&t.entries.length>=3)return z(t.schema===`module-content`?R(t.entries,e):t.entries);let n=lt(e);return n.length?z(n):t?.entries.length?z(t.schema===`module-content`?R(t.entries,e):t.entries):z(X(e).map(e=>({title:e,body:e,quote:e.slice(0,80)})))}function z(e){let t=new Set,n=[];for(let r of e){let e=r.title.toLowerCase().replace(/[\s\p{P}\p{S}]+/gu,``);e&&!t.has(e)&&(t.add(e),n.push(r))}return n}function dt(e,t=[]){let n=ut(e);if(!n.length)return t.filter(e=>!e.kind);let r=new Map(t.filter(e=>!e.kind&&!e.parentId).map(e=>[e.title.toLowerCase().replace(/[\s\p{P}\p{S}]+/gu,``),e])),i=new Set(t.map(e=>e.id)),a=[];n.forEach((e,t)=>{let n=e.title.toLowerCase().replace(/[\s\p{P}\p{S}]+/gu,``),o=r.get(n);if(o){a.push({...o,title:e.title,quote:e.quote||o.quote,body:e.body||o.body,kind:void 0,parentId:void 0});return}let s=`RO-E-${t+1}`,c=1;for(;i.has(s);)s=`RO-E-${t+1}-${c++}`;i.add(s),a.push({id:s,title:e.title,quote:e.quote,body:e.body})});let o=new Set(a.map(e=>e.id)),s=t.filter(e=>e.parentId&&o.has(e.parentId));return[...a,...s]}function B(e){let t=e.filter(e=>e.kind&&e.parentId);return t.length?t:e.filter(e=>!e.parentId)}function ft(e,t){let n=new Set(t.flatMap(e=>e.sourceRefs));return B(e).filter(e=>!n.has(e.id))}function pt(e,t=12){let n=Math.max(1,Math.floor(t)||12),r=B(e);if(!r.length)return[];let i=e.filter(e=>!e.parentId&&!e.kind),a=new Map(i.map(e=>[e.id,e])),o=new Map,s=[];for(let e of r){let t=e.parentId||``;if(t&&a.has(t)){let n=o.get(t)??[];n.push(e),o.set(t,n)}else s.push(e)}let c=[],l=(e,t)=>{for(let r=0;r<t.length;r+=n)c.push({parent:e,mustCover:t.slice(r,r+n)})};for(let e of i){let t=o.get(e.id);t?.length&&l(e,t)}return s.length&&l(null,s),c}function mt(e,t){let n=String(e??``);if(!n)return 2**53-1;let r=q(t,n);return r>=0?r:2**53-1}function V(e,t){if(t.length<=1)return[...t];let n=e.body||e.quote||``;return[...t].map((e,t)=>({p:e,index:t,rank:mt(n,e)})).sort((e,t)=>e.rank===t.rank?e.index-t.index:e.rank-t.rank).map(e=>e.p)}function ht(e,t){return`${e}-${t}`}function H(e,t){return e.filter(e=>e.parentId===t)}function U(e,t,n){let r=new Map,i=n.map((e,n)=>{let i=ht(t,n+1),a=e.id;a&&!a.startsWith(`__new_`)&&a!==i&&r.set(a,i);let o={id:i,title:e.title,quote:e.quote,kind:e.kind,parentId:t};return e.body&&(o.body=e.body),o}),a=e.filter(e=>e.parentId!==t),o=a.findIndex(e=>e.id===t);return{outline:o<0?[...a,...i]:[...a.slice(0,o+1),...i,...a.slice(o+1)],idMap:r}}function gt(e,t){let n=H(e,t.id);if(!n.length)return{outline:[...e],idMap:new Map};let r=V(t,n);return U(e,t.id,r)}function _t(e){let t=[...e],n=new Map,r=t.filter(e=>!e.parentId&&!e.kind);for(let e of r){let r=gt(t,e);t=r.outline;for(let[e,t]of r.idMap)n.set(e,t)}return{outline:t,idMap:n}}function vt(e,t){let n=e.find(e=>e.id===t);if(!n?.parentId||!n.kind)return{outline:[...e],pointId:t,idMap:new Map,parentId:``,error:`必须是已有的查询/修改子点`};let r=e.find(e=>e.id===n.parentId&&!e.parentId&&!e.kind);if(!r)return{outline:[...e],pointId:t,idMap:new Map,parentId:n.parentId,error:`找不到所属需求条目`};if(H(e,r.id).every(e=>e.id.startsWith(`${r.id}-`)))return{outline:[...e],pointId:t,idMap:new Map,parentId:r.id};let i=gt(e,r),a=i.idMap.get(t)??t;return{outline:i.outline,pointId:a,idMap:i.idMap,parentId:r.id}}function yt(e,t){let n=new Map;for(let[r,i]of e)n.set(r,t.get(i)??i);for(let[e,r]of t)n.has(e)||n.set(e,r);return n}function bt(e,t,n){let r=vt(e,t);if(r.error)return{outline:[...e],idMap:new Map,addedIds:[],error:r.error.includes(`必须是`)?`afterId 必须是已有的查询/修改子点`:r.error};if(!n.length)return{outline:r.outline,idMap:r.idMap,addedIds:[]};let i=r.parentId,a=H(r.outline,i),o=a.findIndex(e=>e.id===r.pointId);if(o<0)return{outline:r.outline,idMap:r.idMap,addedIds:[],error:`找不到锚点子点`};let s=n.map((e,t)=>{let n={id:`__new_${t}`,title:e.title,quote:e.quote,kind:e.kind,parentId:i};return e.body&&(n.body=e.body),n}),c=[...a.slice(0,o+1),...s,...a.slice(o+1)],l=U(r.outline,i,c),u=n.map((e,t)=>ht(i,o+2+t));return{outline:l.outline,idMap:yt(r.idMap,l.idMap),addedIds:u}}function xt(e,t){let n=vt(e,t);if(n.error)return{outline:[...e],idMap:new Map,removedId:t,removedIds:new Set([t]),error:n.error.includes(`必须是`)?`只能删除查询/修改子点`:n.error};let r=n.parentId,i=n.pointId,a=new Set([t,i]);for(let[e,t]of n.idMap)(t===i||e===i)&&a.add(e);let o=H(n.outline,r).filter(e=>e.id!==i),s=U(n.outline,r,o),c=new Map([...n.idMap].filter(([e,t])=>!a.has(e)&&!a.has(t)));return{outline:s.outline,idMap:yt(c,s.idMap),removedId:i,removedIds:a}}function St(e,t,n){let r=e.findIndex(e=>e.id===t);if(r<0)return{outline:[...e],error:`找不到需求点`};let i=e[r];if(!i.parentId||!i.kind)return{outline:[...e],error:`只能修改查询/修改子点的原文`};if(n.kind&&n.kind!==`query`&&n.kind!==`mutate`)return{outline:[...e],error:`kind 只能是 query 或 mutate`};let a=[...e],o={...i,quote:n.quote};return n.title!==void 0&&n.title.trim()&&(o.title=n.title.trim()),n.kind&&(o.kind=n.kind),n.body!==void 0&&(n.body?o.body=n.body:delete o.body),a[r]=o,{outline:a}}function Ct(e,t,n=new Set){if(!t.size&&!n.size)return e;let r=e=>n.has(e)?null:t.get(e)??e,i=e=>v(e.map(r).filter(e=>!!e)),a=e.stories.map(e=>({...e,sourceRefs:i(e.sourceRefs)})),o=e=>{if(!e.outlineId)return e;let t=r(e.outlineId);return t===e.outlineId?e:t==null?{...e,outlineId:void 0}:{...e,outlineId:t}},s=e.check?{...e.check,gaps:e.check.gaps.map(o)}:e.check,c=e.ignoredGaps?.map(o);return{...e,stories:a,check:s,ignoredGaps:c}}function W(e,t=[]){let n=e.filter(e=>!e.parentId&&!e.kind),r=e.filter(e=>e.kind&&!e.parentId),i=new Set(t.flatMap(e=>e.sourceRefs)),a=new Map;for(let t of e){if(!t.parentId)continue;let e=a.get(t.parentId)??[];e.push(t),a.set(t.parentId,e)}let o=n.map(e=>{let n=a.get(e.id)??[],r=n.length>0&&n.every(t=>t.id.startsWith(`${e.id}-`))?n:V(e,n),o=r.length?r:[e],s=o.filter(e=>i.has(e.id)).length,c=t.filter(t=>t.sourceRefs.some(t=>t===e.id||r.some(e=>e.id===t)));return{parent:e,points:r,coveredCount:s,totalPoints:o.length,coveringStories:c}});if(r.length&&!n.length)for(let n of e)o.push({parent:n,points:n.kind?[n]:[],coveredCount:+!!i.has(n.id),totalPoints:1,coveringStories:t.filter(e=>e.sourceRefs.includes(n.id))});else r.length&&o.push({parent:{id:`__orphan__`,title:`其它需求点`,quote:``,body:``},points:r,coveredCount:r.filter(e=>i.has(e.id)).length,totalPoints:r.length,coveringStories:t.filter(e=>r.some(t=>e.sourceRefs.includes(t.id)))});return o}function G(e){let t=new Map,n=0;for(let r of W(e)){t.has(r.parent.id)||t.set(r.parent.id,n++);for(let e of r.points)t.has(e.id)||t.set(e.id,n++)}return t}var wt=500,Tt=12e3;function Et(e,t){if(!e.length)return`(无需求点)`;let n=Math.max(40,t?.excerptMax??wt),r=Math.max(40,t?.blockMax??Tt),i=W(e);if(!i.length)return`(无需求点)`;let a=[];for(let e of i){let t=e.parent.id===`__orphan__`?`- ${e.parent.title}`:`- ${e.parent.id} ${e.parent.title}`;if(a.push({kind:`parent`,text:t,shrinkable:!1}),!e.points.length)a.push({kind:`empty`,text:` (尚无查/改子点)`,shrinkable:!1});else for(let t of e.points){let e=t.kind===`query`?`查询`:t.kind===`mutate`?`修改`:`子点`;a.push({kind:`point`,text:` - ${t.id} [${e}] ${t.title}`,shrinkable:!1});let r=(t.body||t.quote||``).replace(/\s+/g,` `).trim();if(r){let e=r.length>n?`${r.slice(0,n).trimEnd()}…`:r;a.push({kind:`excerpt`,text:` 原文:${e}`,shrinkable:!0})}}}let o=e=>e.map(e=>e.text).join(`
|
|
16
|
-
`),s=e=>e.length<=r?e:e.slice(0,r),c=o(a);if(c.length<=r)return c;let l=a.map(e=>({...e}));for(let e=0;e<3&&o(l).length>r;e++){let t=Math.max(40,Math.floor(n/(e+2)));for(let e=0;e<l.length;e++){let n=l[e];if(!n.shrinkable||n.kind!==`excerpt`)continue;let r=n.text.replace(/^ {4}原文:/,``);r.length<=t||(l[e]={...n,text:` 原文:${r.slice(0,t).trimEnd()}…`})}}return c=o(l),c.length<=r?c:s(o(l.filter(e=>!e.shrinkable)))}function Dt(e,t){if(e.length<=1)return[...e];let n=G(t),r=e=>{if(!e.sourceRefs.length)return 2**53-1;let t=2**53-1;for(let r of e.sourceRefs){let e=n.get(r);e!=null&&e<t&&(t=e)}return t};return[...e].map((e,t)=>({s:e,index:t,r:r(e)})).sort((e,t)=>e.r===t.r?e.index-t.index:e.r-t.r).map(e=>e.s)}function Ot(e){let t=new Map;for(let n of e){let e=n.kind===`query`?`查询`:n.kind===`mutate`?`修改`:``;t.set(n.id,e?`${n.title}(${e})`:n.title)}return t}function kt(e){let t=Ot(e),n=new Map;for(let r of e){let e=t.get(r.id)||r.title;n.set(r.id,`${r.id} ${e}`.trim())}return n}function At(e,t){if(!e.length)return``;let n=kt(t);return e.map(e=>n.get(e)||e).join(`;`)}var jt=2e3,Mt=800;function Nt(e,t){let n=0;for(let r=0;r<e.length;r++)if(!/\s/.test(e[r])){if(n===t)return r;n+=1}return-1}function Pt(e,t,n){if(!n||n.length<4)return-1;let r=t.indexOf(n);return r<0||t.indexOf(n,r+n.length)>=0?-1:Nt(e,r)}function K(e,t){let n=String(e??``).trim(),r=String(t??``);if(!n||!r)return-1;let i=r.indexOf(n),a=n.replace(/\s+/g,``),o=r.replace(/\s+/g,``);if(i<0&&a&&(i=Pt(r,o,a)),i<0){let e=Math.min(4,a.length);for(let t of[64,48,32,24,16,12,8,4]){if(t<e)continue;let s=t<=8;if(n.length>=t){let e=n.slice(0,t),a=s?Ft(r,e):r.indexOf(e);if(a>=0){i=a;break}}let c=a.slice(0,Math.min(t,a.length));if(c.length<e)continue;let l=s?Pt(r,o,c):(()=>{let e=o.indexOf(c);return e>=0?Nt(r,e):-1})();if(l>=0){i=l;break}}}if(i<0){let e=/^(【[^】]{2,30}】)/u.exec(n);e&&n.slice(e[0].length).replace(/\s+/g,``).length<4&&(i=r.indexOf(e[1]))}if(i<0)return-1;let s=r.slice(Math.max(0,i-80),i),c=s.lastIndexOf(`
|
|
17
|
-
`);return c>=0&&(i-=s.length-c-1),i}function Ft(e,t){if(!t||t.length<4)return-1;let n=e.indexOf(t);return n<0||e.indexOf(t,n+t.length)>=0?-1:n}function It(e){let t=String(e??``).replace(/[((]?(查询|修改)[))]?$/u,``).replace(/^(政企通页面管理|政企通)/,``).trim();if(!t)return[];let n=[t,...t.split(/[与、及]/u).map(e=>e.trim()).filter(e=>e.length>=4)];t.length>12&&n.push(t.slice(-12));let r=new Set,i=[];for(let e of n)r.has(e)||e.length<4||(r.add(e),i.push(e));return i.sort((e,t)=>t.length-e.length),i}function q(e,t){let n=K(e.quote||e.body||``,t);if(n>=0)return n;for(let n of It(e.title??``)){let e=Ft(t,n);if(e>=0)return e}return-1}function J(e,t,n){let r=/^\d+[、.]/.test(e.slice(t,Math.min(e.length,t+24)).trimStart()),i=t;for(;i<n;){let t=e.indexOf(`
|
|
18
|
-
`,i);if(t<0||t>=n)return n;let a=t+1;for(;a<n&&(e[a]===`
|
|
19
|
-
`||e[a]===`\r`||e[a]===` `);)a+=1;if(a>=n)return t;let o=e.slice(a,Math.min(n,a+40));if(/^【|^#{2,3}\s|^-{3,}/.test(o)||r&&/^\d+[、.]/.test(o)||a>t+1&&!/^\d+[、.]/.test(o))return t;i=t+1}return n}function Lt(e,t,n){if(n<=t||n>=e.length)return!1;let r=e.slice(t,n),i=e.slice(n,Math.min(e.length,n+48)).trimStart();if(!/^\d+[、.]/.test(i)||/^\d+[、.]/.test(r.trimStart()))return!1;if(/\d+[、.]/.test(r))return!0;let a=r.trimEnd().split(/\n/).pop()?.trim()??``;return/下面分|如下|包括|分别为|计有|默认字段/u.test(a)||/[::))]\s*$/u.test(a)}function Rt(e,t,n=jt,r){let i=String(t??``),a=K(e,i);if(a<0)return``;let o=Math.min(i.length,a+n),s=r?.endBefore!=null&&r.endBefore>a?r.endBefore:void 0;if(s!=null&&!Lt(i,a,s)){let e=J(i,a,Math.min(o,s));return i.slice(a,Math.min(o,s,e)).trim()}let c=J(i,a,o);return i.slice(a,Math.max(c,a+1)).trim()}function zt(e,t,n){let r=Math.min(e.length,t+Mt),i=n==null?r:Math.min(r,n);return i=n!=null&&Lt(e,t,n)?J(e,t,r):J(e,t,i),e.slice(t,i).trim()}function Bt(e,t,n,r,i){if(!e||i<0||!r.length)return e;let a=r.filter(e=>e.id!==t.id&&e.start>i).sort((e,t)=>e.start-t.start)[0]?.id;if(!a)return e;let o=n.find(e=>e.id===a);if(!o)return e;let s=[(o.quote||``).trim(),(o.body||``).trim().split(/\n/)[0]?.trim()||``].filter(e=>e.length>=4);for(let t of s){let n=e.indexOf(t);if(n>0)return e.slice(0,n).trim();let r=t.split(/\n/)[0]?.trim()||``;if(r.length>=4&&r!==t){let t=e.indexOf(r);if(t>0)return e.slice(0,t).trim()}}return e}function Vt(e,t,n){let r=(e.body||``).trim(),i=(e.quote||``).trim(),a=(t?.body||t?.quote||``).trim();if(!a)return{text:r||i||`(无原文切片)`,fromParent:!1};let o=n&&n.length?V(t??{id:``,title:``,quote:``},n):[],s=o.map(e=>({id:e.id,start:q(e,a)})),c=i?K(i,a):-1,l=r?K(r,a):-1,u=c>=0?c:l>=0?l:q(e,a),d;if(u>=0&&s.length){let t=s.filter(t=>t.id!==e.id&&t.start>u).sort((e,t)=>e.start-t.start);t[0]&&(d=t[0].start)}let f=u>=0&&s.some(t=>t.id!==e.id&&t.start===u);if(r)return{text:o.length?Bt(r,e,o,s,u):r,fromParent:!1};if(o.length&&u>=0&&!f&&d!=null){let e=zt(a,u,d);if(e)return{text:e,fromParent:!1}}if(i){if(f)return{text:i,fromParent:!1};if(i.length<400||i.length<a.length*.35){let e=Rt(i,a,Mt,{endBefore:d});if(e&&(e.length>i.length||d!=null))return{text:e,fromParent:!1}}return{text:i,fromParent:!1}}if(u>=0&&!f){let e=zt(a,u,d);if(e)return{text:e,fromParent:!1}}return{text:`(未定位到该需求点对应原文)`,fromParent:!1}}function Ht(e){let t=_(e.title??``);return`${e.type}|${e.storyId||``}|${e.outlineId||``}|${t}`}function Y(e,t){if(Ht(e)===Ht(t))return!0;if(e.type!==t.type||(e.storyId||``)!==(t.storyId||``))return!1;let n=_(e.title??``),r=_(t.title??``);if(!n||!r)return!1;if(n===r)return!0;let i=n.length<=r.length?n:r,a=n.length<=r.length?r:n;return i.length>=8&&a.includes(i)}function Ut(e,t){return t?.length?e.filter(e=>!t.some(t=>Y(e,t))):[...e]}function Wt(e,t,n,r){let i=r?.allowNew!==!1,a=Ut(t,n),o=new Set,s=[],c=0,l=e=>i?!0:e.type===`uncovered-outline`;for(let t of a){let n=e.length?e.find(e=>e.id===t.id&&!o.has(e.id))||e.find(e=>!o.has(e.id)&&Y(e,t)):void 0;if(n)o.add(n.id),s.push({...t,id:n.id,title:n.title,selected:n.selected||t.selected,conclusion:t.conclusion?.trim()||n.conclusion});else{if(!l(t)){c+=1;continue}s.push({...t})}}if(!i)for(let t of e)o.has(t.id)||t.type!==`uncovered-outline`&&(n?.some(e=>Y(t,e))||s.push({...t}));return{gaps:s,suppressed:c}}function Gt(e){let t=e.pending??[],n=e.ignored??[];if(!t.length&&!n.length)return``;let r=[];if(t.length){r.push(`## 上轮待确认(复审底稿:只更新/收敛,禁止新开条;问题仍在则沿用原 title)`);for(let e of t)r.push(`- id=${e.id} type=${e.type} storyId=${e.storyId||`-`} outlineId=${e.outlineId||`-`}`),r.push(` title: ${e.title}`),e.detail?.trim()&&r.push(` detail: ${e.detail.trim()}`),e.conclusion?.trim()&&r.push(` conclusion: ${e.conclusion.trim()}(已有结论待补写,勿另开一条)`);r.push(``)}if(n.length){r.push(`## 已忽略(禁止再报同类,不要求标题字面一致)`);for(let e of n)r.push(`- type=${e.type} storyId=${e.storyId||`-`} outlineId=${e.outlineId||`-`} title: ${e.title}`)}return r.join(`
|
|
20
|
-
`).trim()}function Kt(e){let t=[];return e.role||t.push({key:`role`,label:`缺角色`}),e.goal||t.push({key:`goal`,label:`缺目标`}),e.preconditions.length||t.push({key:`preconditions`,label:`缺前置条件`}),e.mainFlow.length||t.push({key:`mainFlow`,label:`缺主流程`}),e.sourceRefs.length||t.push({key:`sourceRefs`,label:`未挂需求点`}),e.exceptions.length?ln(e)&&e.exceptions.length<2&&t.push({key:`write-exceptions`,label:`写操作异常不足`}):t.push({key:`exceptions`,label:`缺异常场景`}),!e.altFlows.length&&ln(e)&&t.push({key:`altFlows`,label:`缺替代流程`}),e.acceptance.length?e.acceptance.some(e=>!e.then)&&t.push({key:`acceptance-then`,label:`验收缺 then`}):t.push({key:`acceptance`,label:`缺验收标准`}),t}function qt(e){let t=new Set,n=[];for(let r of N(e)){let e=T(r.small);e&&!t.has(e)&&(t.add(e),n.push(r.small))}return n}function Jt(e){let t=N(e);if(!t.length)return``;let n=e=>/[,"\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e,r=[`Ideal 小模块行序(用例「子模块 / 小模块」填下列原文:层级路径取最后一段;最终文件按「需求条目 → 条目内测试点」排序,此序只做兜底):`,`大模块,小模块,优化/问题内容`],i=new Set;for(let e of t){let t=T(e.small);t&&!i.has(t)&&(i.add(t),r.push(`${n(e.big)},${n(e.small)},【${e.title}】`))}return r.join(`
|
|
21
|
-
`)}var Yt=`需求章节顺序`;function Xt(e){let t=String(e??``).replace(/\r\n/g,`
|
|
22
|
-
`).trim();if(!t)return[];let n=[],r=new Set,i=/^(概述|简介|目录|修订|附录|背景|术语|参考)/;for(let e of t.matchAll(/^#{2,3}\s+(.+?)\s*$/gm)){let t=x(e[1]??``);!t||t.length>40||i.test(t)||r.has(t)||(r.add(t),n.push(t))}return n}function Zt(e){let t=String(e??``).replace(/\r\n/g,`
|
|
23
|
-
`),n=t.indexOf(Yt);if(n<0)return[];let r=t.slice(n,n+4e3),i=[],a=new Set;for(let e of r.matchAll(/^\s*\d+[.)、]\s*(.+?)\s*$/gm)){let t=x(e[1]??``);!t||t.length>40||a.has(t)||(a.add(t),i.push(t))}return i}function X(e){let t=qt(e);if(t.length)return t;let n=Zt(e);if(n.length)return n;let r=$t(e);return r.length?r:Xt(e)}function Qt(e){let t=Jt(e);if(t)return t;let n=X(e);return n.length<2?``:[`${Yt}(用例「模块 / 子模块 / 标题」应对齐下列原文;最终文件按此序排列,优先于用户故事 US 编号):`,...n.map((e,t)=>`${t+1}. ${e}`)].join(`
|
|
24
|
-
`)}function $t(e){let t=N(e);if(t.length)return t.map(e=>e.title);let n=String(e??``).replace(/\r\n/g,`
|
|
25
|
-
`).trim(),r=[],i=new Set;for(let e of n.matchAll(/【([^】\n]{1,40})】/g)){let t=x(e[1]??``);!t||t.length>24||i.has(t)||(i.add(t),r.push(t))}return r}function en(e,t,n){return`g_${ke(`${e}|${t}|${n}`)}`}function tn(e){let t=e&&typeof e==`object`?e:{},n=y(t.priority,4);return{id:y(t.id,20),title:y(t.title,200),role:y(t.role,120),goal:y(t.goal,500),value:y(t.value,500),sourceRefs:b(t.sourceRefs,20,40),priority:n===`P0`||n===`P1`||n===`P2`?n:`P1`,preconditions:b(t.preconditions),mainFlow:(Array.isArray(t.mainFlow)?t.mainFlow:[]).map(e=>{let t=e&&typeof e==`object`?e:{};return{actor:y(t.actor,80),action:y(t.action,500),result:y(t.result,500)}}).filter(e=>e.action).slice(0,40),altFlows:(Array.isArray(t.altFlows)?t.altFlows:[]).map(e=>{let t=e&&typeof e==`object`?e:{};return{name:y(t.name,120)||`替代流程`,trigger:y(t.trigger,500),steps:b(t.steps,20)}}).slice(0,20),exceptions:(Array.isArray(t.exceptions)?t.exceptions:[]).map(e=>{let t=e&&typeof e==`object`?e:{};return{scenario:y(t.scenario,500),expected:y(t.expected,500)}}).filter(e=>e.scenario).slice(0,30),postconditions:b(t.postconditions),acceptance:(Array.isArray(t.acceptance)?t.acceptance:[]).map(e=>{let t=e&&typeof e==`object`?e:{};return{given:y(t.given,500),when:y(t.when,500),then:y(t.then,500)}}).filter(e=>e.given||e.when||e.then).slice(0,30),dimensions:b(t.dimensions,12,40)}}function nn(e){return{...e,sourceRefs:[...e.sourceRefs],preconditions:[...e.preconditions],mainFlow:e.mainFlow.map(e=>({...e})),altFlows:e.altFlows.map(e=>({...e,steps:[...e.steps]})),exceptions:e.exceptions.map(e=>({...e})),postconditions:[...e.postconditions],acceptance:e.acceptance.map(e=>({...e})),dimensions:[...e.dimensions]}}function Z(e){let t=e.mainFlow?.[0];return`${_(e.title)}|${t?_(`${t.action}${t.result??``}`):``}`}function rn(e,t){let n=e.map(nn),r=new Map(n.filter(e=>e.id).map(e=>[e.id,e])),i=new Map(n.map(e=>[Z(e),e]));for(let e of t){let t=tn(e);if(!t.title)continue;let a=t.id&&r.get(t.id)||i.get(Z(t));if(a)!a.role&&t.role&&(a.role=t.role),!a.goal&&t.goal&&(a.goal=t.goal),!a.value&&t.value&&(a.value=t.value),a.sourceRefs=v([...a.sourceRefs,...t.sourceRefs]),a.dimensions=v([...a.dimensions,...t.dimensions]),a.preconditions.length||(a.preconditions=[...t.preconditions]),a.mainFlow.length||(a.mainFlow=t.mainFlow.map(e=>({...e}))),a.altFlows.length||(a.altFlows=t.altFlows.map(e=>({...e}))),a.exceptions.length||(a.exceptions=t.exceptions.map(e=>({...e}))),a.postconditions.length||(a.postconditions=[...t.postconditions]),a.acceptance.length||(a.acceptance=t.acceptance.map(e=>({...e}))),t.priority===`P0`&&a.priority!==`P0`?a.priority=`P0`:t.priority===`P1`&&a.priority===`P2`&&(a.priority=`P1`);else{let e={...t,id:``};n.push(e),i.set(Z(e),e)}}return n}function an(e,t){let n=_(e),r=_(t);if(!n||!r)return 0;if(n===r)return 1e3;if(n.includes(r)||r.includes(n))return 800+Math.min(n.length,r.length);let i=n.length<=r.length?n:r,a=n.length<=r.length?r:n,o=0;for(let e=0;e<i.length-1;e++)a.includes(i.slice(e,e+2))&&(o+=1);let s=Math.max(1,i.length-1);return o+Math.round(o/s*10)}var on=4;function sn(e,t){let n=e.map(nn);if(!t.length)return{stories:n,filled:0};let r=new Set(t.filter(e=>e.parentId).map(e=>e.parentId)),i=[...t.filter(e=>e.kind===`query`||e.kind===`mutate`),...t.filter(e=>!e.kind&&!e.parentId&&!r.has(e.id))];if(!i.length)return{stories:n,filled:0};let a=new Set(n.flatMap(e=>e.sourceRefs).filter(e=>i.some(t=>t.id===e))),o=0;for(let e of n){if(e.sourceRefs.length)continue;let t=null,n=0;for(let r of i){if(a.has(r.id))continue;let i=an(e.title,r.title);i>n&&(n=i,t=r)}!t||n<on||(e.sourceRefs=[t.id],a.add(t.id),o+=1)}return{stories:n,filled:o}}function cn(e){return[e.title,e.role,e.goal,e.value,...e.dimensions,...e.preconditions,...e.postconditions,...e.mainFlow.map(e=>`${e.actor??``} ${e.action} ${e.result??``}`),...e.altFlows.map(e=>`${e.name} ${e.trigger} ${e.steps.join(` `)}`),...e.exceptions.map(e=>`${e.scenario} ${e.expected}`),...e.acceptance.map(e=>`${e.given} ${e.when} ${e.then}`)].join(` `)}function ln(e){return e.mainFlow.some(e=>ge.test(e.action))}function un(e,t,n,r,i,a,o=``){return{id:en(e,t||o,n),storyId:t,outlineId:o||void 0,type:e,severity:a,title:n,detail:r,suggestion:i,origin:`rule`,selected:!1}}var dn=new Set([`缺少角色`,`缺少目标`,`缺少前置条件`,`缺少主流程`,`没有异常场景`,`写操作缺少异常分支`,`缺少验收标准`,`验收标准缺 then`,`没有关联需求条目`,`只写了主流程`]);function fn(e){let t=e.outline??[],n=e.stories??[],r=[],i=B(t),a=new Set(n.flatMap(e=>e.sourceRefs));for(let e of i){if(a.has(e.id))continue;let t=e.kind===`query`?`查询`:e.kind===`mutate`?`修改`:``,n=t?`${e.title}(${t})`:e.title;r.push(un(`uncovered-outline`,``,`${n}:还没有用户故事挂上`,`需求点「${n}」在文档里有,但目前没有任何故事引用它。可能是漏拆了,也可能这块其实不用测。`,`跟业务确认要不要覆盖:要的话补一条故事(或在已有故事里挂上这个点);不要的话直接忽略。`,`high`,e.id))}let o=he.map(e=>{let t=n.filter(t=>{let n=cn(t).toLowerCase();return e.keywords.some(e=>n.includes(e.toLowerCase()))}).map(e=>e.id);return{key:e.key,label:e.label,covered:t.length>0,stories:t}}),s=i.filter(e=>a.has(e.id)).length,c={total:i.length,covered:s,rate:i.length?s/i.length:0};return{at:new Date().toISOString(),summary:`规则检查:${n.length} 个故事、${i.length} 个需求点,覆盖率 ${i.length?Math.round(c.rate*100):0}%,${r.length} 项待确认未覆盖。`,coverage:c,dimensions:o,gaps:r}}function pn(e,t){let n=e.map(e=>({...e})),r=new Map(n.map(e=>[`${e.storyId}|${e.type}`,e])),i=new Set(n.map(e=>e.id));for(let e of t){if(i.has(e.id))continue;let t=`${e.storyId}|${e.type}`,a=r.get(t);a?dn.has(a.title)?(a.title=e.title,a.detail=[a.detail,e.detail].filter(Boolean).join(` / `),a.suggestion=e.suggestion||a.suggestion,a.severity=e.severity):_(a.title)!==_(e.title)&&(n.push({...e}),i.add(e.id)):(n.push({...e}),r.set(t,e),i.add(e.id))}return n}function mn(e,t){let n=[],r=``;for(let i of e.split(/\n{2,}/)){let e=r?`${r}\n\n${i}`:i;if(e.length<=t)r=e;else if(r&&n.push(r),i.length<=t)r=i;else{for(let e=0;e<i.length;e+=t)n.push(i.slice(e,e+t));r=``}}return r&&n.push(r),n}function hn(e,t=ae){let n=String(e??``).replace(/\r\n/g,`
|
|
26
|
-
`).trim();if(!n)return[];let r=Math.max(2e3,Math.floor(t));if(n.length<=r)return[{index:0,title:``,text:n}];let i=[],a=``,o=[],s=()=>{let e=o.join(`
|
|
27
|
-
`).trim();e&&i.push({title:a,text:e}),o=[]};for(let e of n.split(`
|
|
28
|
-
`)){let t=/^#{2,6}\s+(.+?)\s*$/.exec(e);t&&(s(),a=t[1]),o.push(e)}if(s(),!i.length)return[{index:0,title:``,text:n}];let c=[],l=``,u=``,d=()=>{let e=l.trim();if(e){for(let t of e.length>r?mn(e,r):[e])c.push({index:c.length,title:u,text:t});l=``}};for(let e of i){let t=l?`${l}\n\n${e.text}`:e.text;t.length<=r?(l||(u=e.title),l=t):(d(),u=e.title,l=e.text,l.length>r&&d())}return d(),c.length?c:[{index:0,title:``,text:n}]}function Q(e,t){return t?`- **${e}**:${t}`:``}function gn(e){return e.filter(Boolean).map(e=>`- ${e}`)}function _n(e,t=[]){let n=[];n.push(`### ${e.id} ${e.title}`),n.push(``);let r=t.length?At(e.sourceRefs,t):e.sourceRefs.join(`、`),i=[Q(`角色`,e.role),Q(`目标`,e.goal),Q(`价值`,e.value),Q(`优先级`,e.priority),Q(`来源条目`,r)].filter(Boolean);if(n.push(...i),i.length&&n.push(``),e.preconditions.length&&(n.push(`**前置条件**`),n.push(...gn(e.preconditions)),n.push(``)),e.mainFlow.length&&(n.push(`**主流程**`),e.mainFlow.forEach((e,t)=>{let r=e.actor?`${e.actor}:`:``;n.push(`${t+1}. ${r}${e.action}${e.result?` → ${e.result}`:``}`)}),n.push(``)),e.altFlows.length){n.push(`**替代流程**`);for(let t of e.altFlows)n.push(`- **${t.name}**${t.trigger?`(触发:${t.trigger})`:``}`),t.steps.forEach((e,t)=>n.push(` ${t+1}. ${e}`));n.push(``)}if(e.exceptions.length){n.push(`**异常场景**`);for(let t of e.exceptions)n.push(`- ${t.scenario}${t.expected?` → ${t.expected}`:``}`);n.push(``)}if(e.postconditions.length&&(n.push(`**后置条件**`),n.push(...gn(e.postconditions)),n.push(``)),e.acceptance.length){n.push(`**验收标准**`);for(let t of e.acceptance)n.push(`- Given ${t.given||`(未写)`};When ${t.when||`(未写)`};Then ${t.then||`(未写)`}`);n.push(``)}return e.dimensions.length&&(n.push(`**覆盖维度**:${e.dimensions.join(`、`)}`),n.push(``)),n[n.length-1]!==``&&n.push(``),n}function vn(e,t){let n=new Set((t??[]).filter(Boolean)),r=n.size?e.stories.filter(e=>n.has(e.id)):e.stories,i=[];if(i.push(`# ${e.title||`需求分析`} · 用户故事`),i.push(``),i.push(`> 来源需求文档:\`${e.sourcePath||`(未指定)`}\` · 状态:${se[e.status].label} · 更新:${e.updatedAt}`),i.push(``),e.outline.length){i.push(`## 需求条目`),i.push(``),i.push(`> 「引用需求点」请填下列真实 RO id,格式「RO-id 标题」;不要填 US-…。`),i.push(``);for(let t of W(e.outline,r)){if(i.push(`### ${t.parent.id} ${t.parent.title}`),t.parent.quote||t.parent.body){let e=(t.parent.quote||t.parent.body||``).replace(/\s+/g,` `).slice(0,200);i.push(`> ${e}`)}if(t.points.length)for(let e of t.points){let t=e.kind===`query`?`查询`:e.kind===`mutate`?`修改`:``;i.push(`- **${e.id}** ${e.title}${t?`(${t})`:``}`),e.quote&&i.push(` > ${e.quote.replace(/\n+/g,` `)}`)}i.push(``)}}i.push(`## 用户故事`),i.push(``),r.length||(i.push(`- (暂无)`),i.push(``));let a=Dt(r,e.outline);for(let t of a)i.push(..._n(t,e.outline));return i.join(`
|
|
29
|
-
`)}function yn(e){return(S(e)||`需求分析`).replace(/[\\/:*?"<>|]/g,`_`).slice(0,60)}function $(e,t){let n=String(t??``).trim();if(n.length<2)return null;let r=e.indexOf(n);if(r>=0)return e.slice(r,r+n.length).replace(/\s+/g,` `).trim();let i=n.replace(/\s+/g,``);if(i.length<4)return null;let a=``,o=[];for(let t=0;t<e.length;t+=1)/\s/.test(e[t])||(o.push(t),a+=e[t]);let s=a.indexOf(i);if(s<0)return null;let c=o[s],l=o[s+i.length-1]+1;return e.slice(c,l).replace(/\s+/g,` `).trim()}function bn(e){let t=String(e??``),n=(t.match(/```(?:json)?\s*([\s\S]*?)```/)?.[1]??t).trim(),r=n.indexOf(`{`),i=n.lastIndexOf(`}`);if(r<0||i<=r)return null;try{return JSON.parse(n.slice(r,i+1))}catch{return null}}function xn(e){let t=Array.isArray(e)?e:e&&typeof e==`object`&&Array.isArray(e.groups)?e.groups:[],n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=String(e.category??``).trim(),r=e.items,i=[];for(let e of Array.isArray(r)?r:[]){if(!e||typeof e!=`object`)continue;let t=String(e.title??``).trim(),n=String(e.body??``).trim();(t||n)&&i.push({title:t,body:n})}t&&i.length&&n.push({category:t,items:i})}return n}function Sn(e,t){let n=String(e??``);if(!n.trim())return null;let r=[],i=[];for(let e of xn(t)){let t=$(n,e.category),a=[];for(let t of e.items){let e=$(n,t.body||t.title);if(!e)continue;let r=$(n,t.title)||e.slice(0,40);a.push({title:r,body:e})}a.length&&(t?i.push({category:t,items:a}):r.push(...a))}return r.length&&i.push({category:`未分大类`,items:r}),i.length?i:null}function Cn(e){let t=[],n=new Map;for(let r of e)for(let e of r)n.has(e.category)||(n.set(e.category,[]),t.push(e.category)),n.get(e.category).push(...e.items);return t.map(e=>({category:e,items:n.get(e)}))}var wn=/(?:需求编号|编号)\s*[||::]\s*([A-Za-z]{1,8}(?:-\d+)+)/,Tn=/(?:^|[\s。;;||])(\d{1,2}(?:[、.]|\.(?=\s)))/g;function En(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Dn(e,t){if(!t)return e.trim();let n=RegExp(`(?:需求编号|编号)\\s*[||::]\\s*${En(t)}(?:\\s*功能名称\\s*[||][\\s\\S]*?功能描述\\s*[||]\\s*)?`);return e.replace(n,``).replace(/^[\s||::]+/,``).trim()}function On(e){let t=rt.exec(e);if(!t||t.index==null)return e.trim();let n=t.index,r=t[0].match(/^[。;;]/);return r&&(n+=r[0].length),e.slice(0,n).replace(/[\s||]+$/,``).trim()}function kn(e){let t=[];for(let n of e.matchAll(Tn)){let e=n[1];e&&n.index!=null&&t.push(n.index+n[0].length-e.length)}return t.map((n,r)=>({start:n,text:e.slice(n,t[r+1]??e.length).trim()}))}function An(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return{id:``,parts:[]};let n=wn.exec(t)?.[1]??``,r=kn(t),i=[],a=e=>{let t=On(Dn(e,n));t&&i.push(t)};if(r.length){a(t.slice(0,r[0].start));for(let e of r)a(e.text)}else a(n?Dn(t,n):t);return{id:n,parts:i}}function jn(e,t){return t.map((t,n)=>({id:`${e}-${n+1}`,title:t,role:`body`,children:[]}))}function Mn(e,t){return{id:`root`,title:e,role:`root`,children:t.map((e,t)=>({id:`cat-${t+1}`,title:e.category,role:`group`,children:e.items.map((e,n)=>{let r=e.title.replace(/\s+/g,` `).trim(),{id:i,parts:a}=An(e.body),o=jn(`body-${t+1}-${n+1}`,a.filter(e=>e!==r&&e!==i));return{id:`title-${t+1}-${n+1}`,title:e.title,role:`step`,children:i?[{id:`code-${t+1}-${n+1}`,title:i,role:`code`,children:o}]:o}})}))}}function Nn(e){let t=[`# ${e.title} · 需求原文`,``];if(!e.children.length)return t.push(`- (还没有原文结构,请先拆解需求)`,``),`${t.join(`
|
|
30
|
-
`).trimEnd()}\n`;for(let n of e.children){t.push(`## ${n.title}`,``);for(let e of n.children){t.push(`### ${e.title}`,``);for(let n of e.children)if(n.role===`code`){t.push(n.title,``);for(let e of n.children)t.push(`- ${e.title}`,``);n.children.length&&t.push(``)}else t.push(n.title,``)}}return`${t.join(`
|
|
31
|
-
`).trimEnd()}\n`}function Pn(e){let t=S(e)||e.title||`需求分析`,n=e.sourceExport?.groups??[];return n.length?Nn(Mn(t,n)):`# ${t} · 需求原文\n\n- (还没有原文结构,请先拆解需求)\n`}function Fn(e){let t=new Date().toISOString().slice(0,10),n=`${yn(e)}-需求原文-${t}.md`;return p(new Blob([Pn(e)],{type:`text/markdown;charset=utf-8`}),n),n}function In(e){let t=e.role===`group`?f:e.role===`code`||e.role===`step`?ee:void 0,n=e.children.map(In);return{id:l(`src`,e.id),title:e.title,structureClass:n.length?r:void 0,style:t,children:n.length?{attached:n}:void 0}}function Ln(e){let t=Mn(S(e)||e.title||`需求分析`,e.sourceExport?.groups??[]);return[{id:`sheet-1`,class:`sheet`,title:t.title,theme:te(),rootTopic:{id:`root-topic`,title:t.title,structureClass:r,style:d,children:{attached:t.children.map(In)}}}]}async function Rn(e){let t=new Date().toISOString().slice(0,10),n=`${yn(e)}-需求原文-${t}.xmind`;return p(await ne(Ln(e)),n),n}export{dt as $,bt as A,kt as B,fe as C,Qt as D,He as E,Cn as F,Te as G,Ot as H,rn as I,xt as J,Wt as K,_t as L,ve as M,Ee as N,en as O,pn as P,Be as Q,B as R,Ut as S,Et as T,bn as U,Vt as V,we as W,S as X,C as Y,Ue as Z,$t as _,h as a,Ce as at,Se as b,re as c,be as ct,pt as d,d as dt,Dt as et,Ie as f,ee as ft,Rn as g,l as gt,Fn as h,te as ht,ie as i,Kt as it,Fe as j,W as k,Sn as l,r as lt,xe as m,ne as mt,me as n,hn as nt,ce as o,ft as ot,ye as p,p as pt,Ct as q,le as r,vn as rt,se as s,St as st,pe as t,Ae as tt,fn as u,f as ut,X as v,Gt as w,sn as x,_e as y,G as z};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import{X as e,dt as t,ft as n,gt as r,ht as i,lt as a,mt as o,pt as s,r as c,s as l,t as u,ut as d}from"./req-analysis.FrD6BfwK.js";function f(t){return e(t)}var p=`/__tb_testpoints`,m=`测试点生成提示词.md`,h=[`functional`,`boundary`,`exception`,`business`,`nonfunctional`],g=[`P0`,`P1`,`P2`,`P3`],_={functional:{label:`功能`,hint:`主流程 / 替代流程 / 每个功能点`,tone:`blue`,accent:`bg-[#3370ff]`},boundary:{label:`边界值`,hint:`为空 / 上下限 / 刚好越界`,tone:`purple`,accent:`bg-[#7b5bd6]`},exception:{label:`异常`,hint:`失败路径 / 非法输入 / 并发`,tone:`red`,accent:`bg-[#e5484d]`},business:{label:`业务规则`,hint:`状态流转 / 权限 / 唯一性`,tone:`amber`,accent:`bg-[#d9820b]`},nonfunctional:{label:`非功能`,hint:`性能 / 安全 / 兼容 / 时区`,tone:`green`,accent:`bg-[#2f9e44]`}},v={P0:{label:`P0`,tone:`red`,markerId:`priority-1`},P1:{label:`P1`,tone:`amber`,markerId:`priority-2`},P2:{label:`P2`,tone:`blue`,markerId:`priority-3`},P3:{label:`P3`,tone:`gray`,markerId:`priority-4`}},y=Object.fromEntries(h.map(e=>[e,_[e].label]));async function b(e,t){let n=await fetch(`${p}${e}`,{...t,headers:t?.body===void 0?void 0:{"Content-Type":`application/json`,...t?.headers}}),r=await n.json().catch(()=>({}));if(!n.ok||r.ok===!1)throw Error(r.error||`HTTP ${n.status}`);return r}async function x(){try{let e=await b(`/prompt`);return{file:m,exists:e.exists===!0,generate:e.generate??``}}catch(e){return{file:m,exists:!1,generate:``,error:e instanceof Error?e.message:String(e)}}}async function S(e){return b(`/prompt/sync`,{method:`POST`,body:JSON.stringify({enabled:e})})}var C={P0:0,P1:1,P2:2,P3:3};function w(e){let t=e?.points??[],n={P0:0,P1:0,P2:0,P3:0};for(let e of t)e.priority in n&&(n[e.priority]+=1);return{total:t.length,byPriority:n,coveredDimensions:h.filter(e=>t.some(t=>t.dimension===e)).length}}function T(e){return[...e].sort((e,t)=>Number(!!e.supplemental)-Number(!!t.supplemental)||h.indexOf(e.dimension)-h.indexOf(t.dimension)||C[e.priority]-C[t.priority]||e.title.localeCompare(t.title,`zh`))}function E(e,t=[]){if(!e.length)return``;let n=D(e,t),r=[],i=`\0`;for(let e of n){let t=e.storyId||``;t!==i&&(i=t,r.push(t?`#### ${t}`:`#### 全局测试点`)),r.push(`- **[${e.priority}]** ${e.title}(${e.id})`),e.storyId&&r.push(` - 来源故事:${e.storyId}`),r.push(` - 维度:${_[e.dimension].label}`),e.precondition&&r.push(` - 前置:${e.precondition}`),e.steps.length&&r.push(` - 步骤:${e.steps.join(`;`)}`),e.expected&&r.push(` - 预期:${e.expected}`)}return r.join(`
|
|
2
|
-
`)}function D(e,t=[]){if(!e.length)return[];if(!t.length)return[...e];let n=new Map(t.map((e,t)=>[e,t]));return e.map((e,t)=>({point:e,index:t})).sort((e,r)=>(e.point.storyId?n.get(e.point.storyId)??t.length+1:t.length)-(r.point.storyId?n.get(r.point.storyId)??t.length+1:t.length)||e.index-r.index).map(e=>e.point)}function O(e){return(e||`需求分析`).replace(/[\\/:*?"<>|]/g,`_`).slice(0,60)}function k(e){let t=[];return e.precondition&&t.push(`前置条件:${e.precondition}`),e.steps.length&&(t.push(`步骤:`),e.steps.forEach((e,n)=>t.push(`${n+1}. ${e}`))),e.expected&&t.push(`预期:${e.expected}`),t.join(`
|
|
3
|
-
`)}function A(e){return{id:r(`tp`,e.id),title:`[${e.priority}] ${e.title}`,labels:[_[e.dimension].label],markers:[{markerId:v[e.priority].markerId}],notes:{plain:{content:k(e)}}}}var j=[{re:/ai\s*拆解|推送ai|回写拆解/i,title:`ai拆解`},{re:/ai自动同步|知识信息列表.*开关|知识信息管理/i,title:`知识信息管理`},{re:/信息审核|审核倒计时|出具审核结论|待审核信息/i,title:`政企通信息审核`},{re:/信息确认|确认无误|待确认信息/i,title:`政企通信息确认`},{re:/开通确认|确认开通/i,title:`政企通开通确认`},{re:/信息管理列表|承办单位修改|查看详情|政企通路径|关联信息标题/i,title:`政企通信息管理`},{re:/页面管理|页面树|节点|前台预览|本级节点布局|暂存|发给承办|信息列表|展示类型/i,title:`政企通页面管理`},{re:/菜单|子菜单|文案本地化|时间展示/i,title:`政企通`}];function M(e,t){return t.find(t=>t===e)||t.find(t=>e.length>=t.length&&e.includes(t))||t.find(t=>t.length>e.length&&t.includes(e))||null}function N(e,t,n){if(!n.length)return e.title||e.id;let r=e.title||``,i=`${r} ${e.sourceRefs.map(e=>t.get(e)||e).join(` `)}`,a=[...n].sort((e,t)=>t.length-e.length||e.localeCompare(t,`zh`));for(let e of j){if(!e.re.test(i))continue;let t=M(e.title,a);if(t)return t}for(let e of a)if(e&&r.includes(e))return e;for(let e of a)if(e&&i.includes(e))return e;for(let e of a){let t=e.split(` · `)[0]?.trim()??``;if(t&&r.includes(t))return e}for(let e of a){let t=e.split(` · `)[0]?.trim()??``;if(t&&i.includes(t))return e}return e.title||e.id}function P(e){let t=T(e);return h.map(e=>({key:e,label:_[e].label,hint:_[e].hint,points:t.filter(t=>t.dimension===e)}))}function F(e,t=[]){let n=e.testPoints?.points??[];if(!n.length)return[];let r=new Map(e.outline.map(e=>[e.id,e.title])),i=new Map(e.stories.map(e=>[e.id,e])),a=t.filter(Boolean),o=new Map,s=e=>{let t=o.get(e);return t||(t={title:e,storyIds:new Set,points:[]},o.set(e,t)),t};for(let e of a)s(e);for(let e of n){let t=e.storyId?i.get(e.storyId):void 0,n;n=t&&a.length?N(t,r,a):t?t.title||t.id:`全局测试点`;let o=s(n);o.points.push(e),e.storyId&&o.storyIds.add(e.storyId)}let c=[...a,...[...o.keys()].filter(e=>!a.includes(e)&&e!==`全局测试点`),...o.has(`全局测试点`)?[`全局测试点`]:[]],l=new Set,u=[];for(let e of c){if(l.has(e))continue;l.add(e);let t=o.get(e);t&&(t.points.length||a.includes(e))&&u.push({key:e,title:e,storyIds:[...t.storyIds],points:T(t.points),dimensions:P(t.points)})}return u}var I=a;function L(e,t){return t.map(t=>{let i=t.points.map(A);return{id:r(`dim`,`${e}:${t.key}`),title:`${t.label}(${t.points.length})`,structureClass:i.length?I:void 0,style:n,notes:{plain:{content:`${_[t.key].hint}\n测试点 ${t.points.length} 条`}},children:{attached:i}}})}function R(e){let t=L(e.key,e.dimensions);return{id:r(`req`,e.key),title:`${e.title}(${e.points.length})`,structureClass:I,style:d,notes:{plain:{content:[e.storyIds.length?`来源故事:${e.storyIds.join(`、`)}`:``,`测试点 ${e.points.length} 条`].filter(Boolean).join(`
|
|
4
|
-
`)}},children:{attached:t}}}function z(e,a=[]){let o=e.testPoints,s=F(e,a).filter(e=>e.points.length>0),c=f(e);if(!s.length)return[{id:`sheet-1`,class:`sheet`,title:c,theme:i(),rootTopic:{id:`root-topic`,title:`${c}(0)`,structureClass:I,style:t,notes:{plain:{content:o?.summary||`还没有测试点。`}},children:{attached:h.map(e=>({id:r(`dim`,e),title:`${_[e].label}(0)`,style:n,notes:{plain:{content:`${_[e].hint}\n测试点 0 条`}},children:{attached:[]}}))}}}];if(s.length===1){let e=s[0];return[{id:`sheet-1`,class:`sheet`,title:e.title,theme:i(),rootTopic:{id:r(`root`,e.key),title:`${e.title}(${e.points.length})`,structureClass:I,style:t,notes:{plain:{content:[o?.summary||``,e.storyIds.length?`来源故事:${e.storyIds.join(`、`)}`:``,`测试点 ${e.points.length} 条`].filter(Boolean).join(`
|
|
5
|
-
`)}},children:{attached:L(e.key,e.dimensions)}}}]}let l=s.reduce((e,t)=>e+t.points.length,0);return[{id:`sheet-1`,class:`sheet`,title:c,theme:i(),rootTopic:{id:`root-topic`,title:c,structureClass:I,style:t,notes:{plain:{content:[o?.summary||``,`测试点 ${l} 条`].filter(Boolean).join(`
|
|
6
|
-
`)}},children:{attached:s.map(R)}}}]}async function B(e,t=[]){return o(z(e,t))}async function V(e,t=[]){let n=new Date().toISOString().slice(0,10),r=`${O(f(e))}-测试点-${n}.xmind`,i=await B(e,t);return s(i,r),r}function H(e,t=[]){let n=e.testPoints,r=f(e),i=[];i.push(`# ${r}`),i.push(``);let a=F(e,t);if(i.push(`> 需求测试点 · 来源:\`${e.sourcePath||`(未指定)`}\` · 需求 ${a.length||e.stories.length} 条 · 测试点 ${n?.points.length??0} 条`),i.push(``),!n?.points.length)return i.push(`- 还没有生成测试点。`),`${i.join(`
|
|
7
|
-
`).trimEnd()}\n`;let o=w(n);i.push(`- 生成时间:${n.at}`),i.push(`- 共 ${o.total} 条(P0 ${o.byPriority.P0} / P1 ${o.byPriority.P1} / P2 ${o.byPriority.P2} / P3 ${o.byPriority.P3})`),i.push(`- 需求 ${a.length} 条 · 维度覆盖 ${o.coveredDimensions}/5`),n.summary&&(i.push(``),i.push(n.summary)),i.push(``);for(let e of a){i.push(`## ${e.title} · ${e.points.length} 条`),i.push(``);for(let t of e.dimensions)if(i.push(`### ${t.label}(${t.points.length})`),i.push(``),!t.points.length)i.push(`- (无)`),i.push(``);else{for(let e of t.points)i.push(`- **[${e.priority}]** ${e.title}`),e.precondition&&i.push(` - 前置:${e.precondition}`),e.steps.length&&i.push(` - 步骤:${e.steps.join(`;`)}`),e.expected&&i.push(` - 预期:${e.expected}`);i.push(``)}}return`${i.join(`
|
|
8
|
-
`).trimEnd()}\n`}function U(e,t=[]){let n=new Date().toISOString().slice(0,10),r=`${O(f(e))}-测试点-${n}.md`,i=new Blob([H(e,t)],{type:`text/markdown;charset=utf-8`}),a=URL.createObjectURL(i),o=document.createElement(`a`);return o.href=a,o.download=r,o.click(),URL.revokeObjectURL(a),r}var W=`/__tb_storyreview`,G=`用户故事审查提示词.md`;async function K(e,t){let n=await fetch(`${W}${e}`,{...t,headers:t?.body===void 0?void 0:{"Content-Type":`application/json`,...t?.headers}}),r=await n.json().catch(()=>({}));if(!n.ok||r.ok===!1)throw Error(r.error||`HTTP ${n.status}`);return r}async function q(){try{let e=await K(`/prompt`);return{file:G,exists:e.exists===!0,review:e.review??``,fix:e.fix??``}}catch(e){return{file:G,exists:!1,review:``,fix:``,error:e instanceof Error?e.message:String(e)}}}async function J(e){return K(`/prompt/sync`,{method:`POST`,body:JSON.stringify({enabled:e})})}var Y={high:0,medium:1,low:2};function X(e){let t={pending:[],uncovered:[],other:[]};for(let n of e)n.type===`uncovered-outline`?t.uncovered.push(n):n.type===`pending-confirm`||n.type===`conflict`?t.pending.push(n):t.other.push(n);let n=e=>[...e].sort((e,t)=>Y[e.severity]-Y[t.severity]||e.title.localeCompare(t.title,`zh`));return[{key:`pending`,label:`待确认`,hint:`原文不清或需业务拍板`,gaps:n(t.pending)},{key:`uncovered`,label:`需求点未覆盖`,hint:`文档点还没有故事挂接`,gaps:n(t.uncovered)},{key:`other`,label:`其它`,hint:`其余待处理项`,gaps:n(t.other)}].filter(e=>e.gaps.length>0)}function Z(e){return{high:e.filter(e=>e.severity===`high`).length,medium:e.filter(e=>e.severity===`medium`).length,low:e.filter(e=>e.severity===`low`).length}}function Q(e,t){let n=[];if(n.push(`# 用户故事审查报告 · ${e.title||`未命名分析`}`),n.push(``),n.push(`> 来源:\`${e.sourcePath||`(未指定)`}\` · 故事 ${e.stories.length} 条`),n.push(``),!t)return n.push(`- 还没有审查结果。`),`${n.join(`
|
|
9
|
-
`)}\n`;let r=t.coverage.total?Math.round(t.coverage.rate*100):0;n.push(`## 结论`),n.push(``),n.push(`- 状态:${l[e.status]?.label??e.status}`),n.push(`- 审查时间:${t.at}`),n.push(`- 需求条目覆盖率:${t.coverage.covered}/${t.coverage.total}(${r}%)`),n.push(`- 维度覆盖:${t.dimensions.map(e=>`${e.label}${e.covered?` ✓`:` ✗`}`).join(` · `)||`(无)`}`);let i=Z(t.gaps);n.push(`- 缺口:${t.gaps.length} 条(高 ${i.high} / 中 ${i.medium} / 低 ${i.low})`),t.summary&&(n.push(``),n.push(t.summary)),n.push(``);let a=new Map(e.stories.map(e=>[e.id,e.title])),o=X(t.gaps);if(!o.length)return n.push(`## 缺口清单`),n.push(``),n.push(`- 没有发现缺口。`),`${n.join(`
|
|
10
|
-
`)}\n`;for(let e of o){n.push(`## ${e.label}(${e.gaps.length})`),n.push(``);for(let t of e.gaps){let e=t.storyId?`${t.storyId}${a.get(t.storyId)?` ${a.get(t.storyId)}`:``}`:`全局`;n.push(`- **[${u[t.severity]}] ${c[t.type]}** · ${e} · ${t.title}`),t.detail&&n.push(` - 原因:${t.detail}`),t.suggestion&&n.push(` - 建议:${t.suggestion}`)}n.push(``)}return`${n.join(`
|
|
11
|
-
`).trimEnd()}\n`}function $(e,t){let n=`${(e.title||`需求分析`).replace(/[\\/:*?"<>|]/g,`_`).slice(0,60)}-审查报告-${new Date().toISOString().slice(0,10)}.md`,r=new Blob([Q(e,t)],{type:`text/markdown;charset=utf-8`}),i=URL.createObjectURL(r),a=document.createElement(`a`);return a.href=i,a.download=n,a.click(),URL.revokeObjectURL(i),n}function ee(e,t,n){if(e.outlineId){let r=t?.get(e.outlineId)?.trim();if(r)return r;let i=n?.get(e.outlineId)?.trim();if(i)return i}return e.detail?.trim()||e.title?.trim()||`(无原文摘录)`}function te(e,t,n){let r=[];if(r.push(`# 待确认事项 · ${e.title||`未命名分析`}`),r.push(``),r.push(`> 来源:\`${e.sourcePath||`(未指定)`}\` · 请在每条「结论」里回填后交回,便于补写用户故事。`),r.push(``),!t?.gaps.length)return r.push(`(当前没有待确认项。)`),`${r.join(`
|
|
12
|
-
`)}\n`;let i=n?.gapIds?.length?new Set(n.gapIds):null,a=i?t.gaps.filter(e=>i.has(e.id)):[...t.gaps];if(!a.length)return r.push(`(未勾选任何项;请先勾选或清空选择后导出全部。)`),`${r.join(`
|
|
13
|
-
`)}\n`;let o=X(a),s=0;for(let e of o)for(let t of e.gaps){s+=1,r.push(`## ${s}. ${t.title}`),r.push(``),r.push(`需求内容:${ee(t,n?.outlineBodies,n?.outlineTitles)}`),r.push(``);let e=t.detail?.trim()||t.title;r.push(`疑问:${e}`),r.push(``),r.push(`结论:${t.conclusion?.trim()||``}`),r.push(``)}return`${r.join(`
|
|
14
|
-
`).trimEnd()}\n`}function ne(e,t,n){let r=`${(e.title||`需求分析`).replace(/[\\/:*?"<>|]/g,`_`).slice(0,60)}-待确认-${new Date().toISOString().slice(0,10)}.md`,i=new Blob([te(e,t,n)],{type:`text/markdown;charset=utf-8`}),a=URL.createObjectURL(i),o=document.createElement(`a`);return o.href=a,o.download=r,o.click(),URL.revokeObjectURL(a),r}export{F as _,q as a,E as b,y as c,g as d,m as f,x as g,V as h,$ as i,_ as l,U as m,Z as n,X as o,w as p,ne as r,J as s,G as t,v as u,D as v,S as y};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import{d as e}from"./app-config.DkyjuL-S.js";var t=[{id:`functional`,folder:`功能测试报告`,label:`功能测试报告`,defaultPrompt:`功能测试报告提示词.md`},{id:`api`,folder:`接口测试报告`,label:`接口测试报告`,defaultPrompt:`接口测试报告提示词.md`},{id:`perf`,folder:`性能测试报告`,label:`性能测试报告`,defaultPrompt:`性能测试报告提示词.md`}],n=`# 测试报告提示词
|
|
2
|
-
|
|
3
|
-
> 由「报告管理」插件按报告类型挂载。日常增删改请只改本空间「提示词管理」里的本文件。
|
|
4
|
-
|
|
5
|
-
## 角色
|
|
6
|
-
|
|
7
|
-
你协助修改已挂载的测试报告正文,保持原有章节结构与口径。
|
|
8
|
-
|
|
9
|
-
## 要求
|
|
10
|
-
|
|
11
|
-
1. 只改作曲区挂载的那份报告文件,其它文件不要动。
|
|
12
|
-
2. 保留原有标题层级与章节顺序;缺段再补,不要整篇重写成别的模板。
|
|
13
|
-
3. 不要编造未提供的测试数据、结论或通过率;缺信息时标明待补充。
|
|
14
|
-
4. 改完说明改了哪些章节。
|
|
15
|
-
|
|
16
|
-
## 限制
|
|
17
|
-
|
|
18
|
-
不要输出与报告无关的闲聊;不要擅自改成日报 / 周报口径。
|
|
19
|
-
`;function r(){let t=e();return t?`tw.testReports.promptMounts.v1:${t}`:`tw.testReports.promptMounts.v1`}function i(){if(typeof localStorage>`u`)return{};try{let e=localStorage.getItem(r());if(!e)return{};let t=JSON.parse(e);return t&&typeof t==`object`?t:{}}catch{return{}}}function a(e){if(typeof localStorage<`u`)try{localStorage.setItem(r(),JSON.stringify(e))}catch{}}function o(e,t){let n={...i()},r=t.trim();return r?n[e]=r:delete n[e],a(n),n}function s(e){return i()[e]?.trim()||(t.find(t=>t.id===e)?.defaultPrompt??``)}function c(e){let n=e.replace(/\\/g,`/`).replace(/^\.\//,``).split(`/`).filter(Boolean)[0]??``;return t.find(e=>e.folder===n)?.id??null}function l(e){return t.find(t=>t.id===e)??t[0]}export{c as a,l as i,n,i as o,o as r,s,t};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{p as e,v as t}from"./project-docs.CCjtiFjB.js";var n=`/__tb_uiauto`,r=`自动化执行提示词.md`,i=`自动化项目提示词.md`;function a(e,t){let n=String(e??``).trim();if(!n)return``;let r=n.split(`
|
|
2
|
-
`),i=[];if(r.forEach((e,t)=>{/^###\s+\S/.test(e)&&i.push(t)}),!i.length)return n;let a=r.slice(0,i[0]).join(`
|
|
3
|
-
`).trim(),o=String(t??``).trim().toLowerCase();if(!o)return a;for(let e=0;e<i.length;e+=1){let t=i[e],n=e+1<i.length?i[e+1]:r.length;if(r[t].replace(/^###\s+/,``).trim().toLowerCase().includes(o))return[a,r.slice(t+1,n).join(`
|
|
4
|
-
`).trim()].filter(Boolean).join(`
|
|
5
|
-
|
|
6
|
-
`)}return a}function o(e,t){let n=String(e??``),r={plan:``,agent:``,code:``,skeleton:``};if(!n.trim())return r;let i=``,o=[],s=()=>{let e=o.join(`
|
|
7
|
-
`).trim();i&&(r[i]=e),o=[]};for(let e of n.split(`
|
|
8
|
-
`)){let t=/^##\s+(.+?)\s*$/.exec(e);if(t){s();let e=t[1];i=/骨架/.test(e)?`skeleton`:/规划/.test(e)?`plan`:/探索/.test(e)?`agent`:/代码|出码/.test(e)?`code`:``}else(i||!/^#\s/.test(e)&&!/^>\s?/.test(e))&&i&&o.push(e)}return s(),r.skeleton=a(r.skeleton,t),r}function s(e){return[`# ${e.replace(/\.md$/i,``).trim()||`自动化执行提示词.md`.replace(/\.md$/i,``)}`,``,`> 自动化测试提示词:生成时按下面三段分别作为「规划 / 探索 / 出码」的系统提示词。`,``,`## 规划阶段`,``,`- 一行一步,只写「动作 + 目标」;`,`- 覆盖:打开页面、关键前置(登录 / 导航)、核心操作、至少一条结果断言。`,``,`## 探索阶段`,``,`- 每一步先用可读描述定位目标,再回填真实定位器;`,`- 关键节点截一张图,方便人确认;`,"- 账号 / 密码等占位数据写成 `${ENV_NAME}`,不要写死。",``,`## 生成代码`,``,`- 复用项目已有的 page object / fixture / 登录态,不要另起一套;`,`- 选择器用探索阶段确认过的定位器,不加与断言无关的 sleep。`,``].join(`
|
|
9
|
-
`)}function c(e){let t=Array.from(String(e??``)).map(e=>e.charCodeAt(0)<32||`\\/:*?"<>|`.includes(e)?` `:e).join(``).replace(/\s+/g,` `).trim();if(!t)return``;let n=/\.md$/i.test(t)?t:`${t}.md`;return n.length>120?``:n}async function l(n,r){let i=c(n);if(!i)throw Error(`文件名不合法:不能包含 / \\ : * ? " < > |`);let a=``;if(r)try{a=(await e(`prompts`,r)).content}catch{a=``}return await t(`prompts`,i,a.trim()?a:s(i)),i}async function u(e){let t=await fetch(`${n}/prompt/sync`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})});if(!t.ok)throw Error(`同步 UI 自动化测试提示词失败(${t.status})`);return await t.json()}async function d(t,n){let r=String(t??``).trim()||`自动化执行提示词.md`,i={ok:!1,file:r,exists:!1,plan:``,agent:``,code:``};try{let{content:t}=await e(`prompts`,r);return{ok:!0,file:r,exists:!!t.trim(),...o(t,n)}}catch(e){return{...i,error:e instanceof Error?e.message:String(e)}}}export{c as a,d as i,r as n,u as o,l as r,i as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=`/__tb_uiauto`;function t(e){return e===`ui`?`UI`:e===`api`?`接口`:e===`test`?`测试`:``}var n={running:{label:`运行中`,tone:`blue`},passed:{label:`通过`,tone:`green`},failed:{label:`失败`,tone:`red`},cancelled:{label:`已取消`,tone:`gray`},error:{label:`错误`,tone:`red`},interrupted:{label:`已中断`,tone:`amber`}};function r(e){return e!==`running`}function i(e){if(!Number.isFinite(e)||e<=0)return`—`;if(e<1e3)return`${Math.round(e)}ms`;let t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;let n=Math.floor(t/60),r=Math.round(t%60);return n<60?`${n}m ${r}s`:`${Math.floor(n/60)}h ${n%60}m`}function a(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString(`zh-CN`,{month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1}):`—`}function o(e,t=`playwright`){if(!e)return`全量`;let n=[];return e.file&&n.push(e.file),e.grep&&(t===`pytest`?n.push(`-k ${e.grep}`):t===`selenium`?n.push(e.grep):n.push(`grep: ${e.grep}`)),t===`pytest`?(e.marker&&n.push(`-m ${e.marker}`),e.lastFailed&&n.push(`--lf`),e.bail&&n.push(`-x`),e.maxFail>0&&n.push(`--maxfail=${e.maxFail}`)):t===`playwright`&&(e.project&&n.push(e.project),e.headed&&n.push(`headed`),e.workers>0&&n.push(`workers=${e.workers}`),e.lastFailed&&n.push(`--last-failed`),e.bail&&n.push(`--max-failures=1`)),n.length?n.join(` · `):`全量`}function s(e){let t=(e??``).trim();if(!t)return``;let n=t[0]===`"`||t[0]===`'`?t[0]:``,r=t,i=``;if(n){let e=t.indexOf(n,1);r=e>0?t.slice(1,e):t.slice(1),i=e>0?t.slice(e+1).trim():``}else{let e=t.search(/\s/);r=e>0?t.slice(0,e):t,i=e>0?t.slice(e+1).trim():``}let a=/[\\/]/.test(r)?r.split(/[\\/]/).pop()??r:r;return i?`${a} ${i}`:a}function c(e){let t=[`共 ${e.total}`,`通过 ${e.passed}`,`失败 ${e.failed}`,`跳过 ${e.skipped}`];return e.flaky>0&&t.push(`不稳定 ${e.flaky}`),t.join(` · `)}async function l(t,n){let r=await fetch(`${e}${t}`,{...n,headers:n?.body===void 0?void 0:{"Content-Type":`application/json`,...n?.headers}}),i=await r.json().catch(()=>({}));if(!r.ok||i.ok===!1)throw Error(i.error||`HTTP ${r.status}`);return i}async function u(){let e=await l(`/projects`);return{projects:e.projects,frameworks:e.frameworks??[]}}function d(e){let t=String(e??``).trim().replace(/\\/g,`/`).replace(/\/+$/,``);return t?(/^[a-zA-Z]:$/.test(t)&&(t+=`/`),t):``}function f(e,t){let n=d(t);if(!n)return null;let r=e.find(e=>d(e.dir)===n);if(r)return r;let i=n.toLowerCase();return e.find(e=>d(e.dir).toLowerCase()===i)??null}async function p(){try{let{projects:e}=await u();return e.map(e=>(e.promptFile??``).trim()).filter(Boolean)}catch{return null}}async function m(e){return l(`/detect`,{method:`POST`,body:JSON.stringify({dir:e})})}async function h(){return(await l(`/scaffold/stacks`)).stacks??[]}async function g(e){return l(`/scaffold/preview`,{method:`POST`,body:JSON.stringify(e)})}async function _(e=`playwright`){return l(`/skeleton?stack=${encodeURIComponent(e)}`)}async function v(e){return l(`/scaffold/check`,{method:`POST`,body:JSON.stringify(e)})}async function y(e){return l(`/scaffold`,{method:`POST`,body:JSON.stringify(e)})}async function b(e){return l(`/scaffold/update`,{method:`POST`,body:JSON.stringify(e)})}var x=`lantern:uiauto:prompt-mounts`;function S(){typeof window<`u`&&window.dispatchEvent(new Event(x))}function C(e){return typeof window>`u`?()=>void 0:(window.addEventListener(x,e),()=>window.removeEventListener(x,e))}async function w(){let e=await l(`/pick-directory`,{method:`POST`});return e.canceled?``:e.dir??``}async function T(e,t=``,n){return(await l(`/projects`,{method:`POST`,body:JSON.stringify({dir:e,name:t,framework:n})})).project}async function E(e){return(await l(`/projects`,{method:`PATCH`,body:JSON.stringify(e)})).project}async function D(e){await l(`/projects?id=${encodeURIComponent(e)}`,{method:`DELETE`})}async function O(e,t={}){let n=await l(`/run`,{method:`POST`,body:JSON.stringify({projectId:e,...t})});return{run:n.run,envWarning:n.envWarning??``}}async function k(e){await l(`/stop`,{method:`POST`,body:JSON.stringify({runId:e})})}async function A(e){return l(`/run/allure`,{method:`POST`,body:JSON.stringify({runId:e})})}async function j(e,t=0){return l(`/run?${new URLSearchParams({id:e,offset:String(t)}).toString()}`)}async function M(e){return l(`/project/setup`,{method:`POST`,body:JSON.stringify({projectId:e})})}async function N(e,t=0){return l(`/project/setup?${new URLSearchParams({projectId:e,offset:String(t)}).toString()}`)}async function P(e){await l(`/project/setup/stop`,{method:`POST`,body:JSON.stringify({projectId:e})})}async function F(e){return(await l(`/scaffold/record?projectId=${encodeURIComponent(e)}`)).record}async function I(e){return(await l(`/runs?projectId=${encodeURIComponent(e)}`)).runs}async function L(e){await l(`/run?id=${encodeURIComponent(e)}`,{method:`DELETE`})}export{O as A,f as C,g as D,w as E,b as F,k as M,c as N,D as O,E as P,r as S,C as T,_,y as a,t as b,m as c,N as d,u as f,h as g,F as h,v as i,P as j,M as k,s as l,I as m,e as n,L as o,j as p,T as r,o as s,n as t,p as u,a as v,S as w,A as x,i as y};
|