@yorz/cli 0.8.2 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/cli/index.js +87 -52
  2. package/dist/gui/assets/{abnfDiagram-VRR7QNED-gKm9Q_A3.js → abnfDiagram-VRR7QNED-D4D9enbi.js} +1 -1
  3. package/dist/gui/assets/{arc-CrUCh7Vt.js → arc-Uhg-Jaz0.js} +1 -1
  4. package/dist/gui/assets/{architectureDiagram-ZJ3FMSHR-CMSfijC7.js → architectureDiagram-ZJ3FMSHR-CCovxlgK.js} +1 -1
  5. package/dist/gui/assets/{blockDiagram-677ZJIJ3-p05lGQvB.js → blockDiagram-677ZJIJ3-BVUdWBA7.js} +1 -1
  6. package/dist/gui/assets/{c4Diagram-LMCZKHZV-Bv-YyQUO.js → c4Diagram-LMCZKHZV-jKUs8qBl.js} +1 -1
  7. package/dist/gui/assets/channel-C2ymEZyD.js +1 -0
  8. package/dist/gui/assets/{chunk-2Q5K7J3B-k4bjrCUS.js → chunk-2Q5K7J3B-BQ1pmtPO.js} +1 -1
  9. package/dist/gui/assets/{chunk-32BRIVSS-kWhk22-t.js → chunk-32BRIVSS-CokJqC_m.js} +1 -1
  10. package/dist/gui/assets/{chunk-5VM5RSS4-CQ-OF-jm.js → chunk-5VM5RSS4-BsTyU26_.js} +1 -1
  11. package/dist/gui/assets/{chunk-EX3LRPZG-BCGCkTIr.js → chunk-EX3LRPZG-BtG1531e.js} +1 -1
  12. package/dist/gui/assets/{chunk-JWPE2WC7-BxQu3HdL.js → chunk-JWPE2WC7-CRJtNYf7.js} +1 -1
  13. package/dist/gui/assets/{chunk-MOJQB5TN-DkB3CKU9.js → chunk-MOJQB5TN-CuSjoqFP.js} +1 -1
  14. package/dist/gui/assets/{chunk-RYQCIY6F-62-xl5oz.js → chunk-RYQCIY6F-Dvq5myJ5.js} +1 -1
  15. package/dist/gui/assets/{chunk-V7JOEXUC-DLidRBp5.js → chunk-V7JOEXUC-2oWWymhr.js} +1 -1
  16. package/dist/gui/assets/{chunk-VR4S4FIN-CelmZEAj.js → chunk-VR4S4FIN-BufsuH8E.js} +1 -1
  17. package/dist/gui/assets/{chunk-XXDRQBXY-CZXSrEO5.js → chunk-XXDRQBXY-CZ-nS8L-.js} +1 -1
  18. package/dist/gui/assets/classDiagram-OUVF2IWQ-BL75FVt0.js +1 -0
  19. package/dist/gui/assets/classDiagram-v2-EOCWNBFH-BL75FVt0.js +1 -0
  20. package/dist/gui/assets/{cose-bilkent-JH36ORCC-BJZADzHX.js → cose-bilkent-JH36ORCC-Gr6ZaATw.js} +1 -1
  21. package/dist/gui/assets/{cynefin-VYW2F7L2-2kv3gQiJ.js → cynefin-VYW2F7L2-C5199IEw.js} +1 -1
  22. package/dist/gui/assets/{cynefinDiagram-TSTJHNR4-BJrGGRZT.js → cynefinDiagram-TSTJHNR4-D6fiPl1f.js} +1 -1
  23. package/dist/gui/assets/{dagre-VKFMJZFB-C2Eq7ks1.js → dagre-VKFMJZFB-Bn8knEMn.js} +1 -1
  24. package/dist/gui/assets/{diagram-FQU43EPY-DrIQap5j.js → diagram-FQU43EPY-DVBF68AQ.js} +1 -1
  25. package/dist/gui/assets/{diagram-G47NLZAW-D3qrZmEa.js → diagram-G47NLZAW-BZ5yrrkI.js} +1 -1
  26. package/dist/gui/assets/{diagram-NH7WQ7WH-BiV6-mMS.js → diagram-NH7WQ7WH-pzIgTU3E.js} +1 -1
  27. package/dist/gui/assets/{diagram-OA4YK3LP-zJhDVFfZ.js → diagram-OA4YK3LP-CPaJk9pC.js} +1 -1
  28. package/dist/gui/assets/{diagram-WEI45ONY-CDimAYs_.js → diagram-WEI45ONY-B-6GmQvM.js} +1 -1
  29. package/dist/gui/assets/{ebnfDiagram-CCIWWBDH-CCcf1QsU.js → ebnfDiagram-CCIWWBDH-Bv1oxmeZ.js} +1 -1
  30. package/dist/gui/assets/{erDiagram-Q63AITRT-Q8tGhvrZ.js → erDiagram-Q63AITRT-W41uQrQk.js} +1 -1
  31. package/dist/gui/assets/{flowDiagram-23GEKE2U-3alKs_Q2.js → flowDiagram-23GEKE2U-CHxHJDVM.js} +1 -1
  32. package/dist/gui/assets/{ganttDiagram-NO4QXBWP-UwtLj5mp.js → ganttDiagram-NO4QXBWP-BUF9vvnT.js} +1 -1
  33. package/dist/gui/assets/{gitGraphDiagram-IHSO6WYX-BkdZNrvw.js → gitGraphDiagram-IHSO6WYX-CdMyc006.js} +1 -1
  34. package/dist/gui/assets/{index-DakqmUCD.js → index-Auit67b0.js} +15 -15
  35. package/dist/gui/assets/{infoDiagram-FWYZ7A6U-AtNZOkv_.js → infoDiagram-FWYZ7A6U-tOoSyFtd.js} +1 -1
  36. package/dist/gui/assets/{ishikawaDiagram-FXEZZL3T-fzZ3wFB-.js → ishikawaDiagram-FXEZZL3T-xzmSx4q7.js} +1 -1
  37. package/dist/gui/assets/{journeyDiagram-5HDEW3XC-CaInQL3L.js → journeyDiagram-5HDEW3XC-DDNB6MLL.js} +1 -1
  38. package/dist/gui/assets/{kanban-definition-HUTT4EX6-BzazGxe7.js → kanban-definition-HUTT4EX6-Bh-NqXAp.js} +1 -1
  39. package/dist/gui/assets/{linear-FkI6GUdc.js → linear-BJWCgfrh.js} +1 -1
  40. package/dist/gui/assets/{mermaid.core-Dy3NGXqh.js → mermaid.core-DmUdNrWd.js} +4 -4
  41. package/dist/gui/assets/{mindmap-definition-LN4V7U3C-BkD5gUUF.js → mindmap-definition-LN4V7U3C-CcwHk-9p.js} +1 -1
  42. package/dist/gui/assets/{pegDiagram-2B236MQR-DrzL8aNW.js → pegDiagram-2B236MQR-DrnMrY4L.js} +1 -1
  43. package/dist/gui/assets/{pieDiagram-ENE6RG2P-BrrJjIcV.js → pieDiagram-ENE6RG2P-B5fQVAQi.js} +1 -1
  44. package/dist/gui/assets/{quadrantDiagram-ABIIQ3AL-BvfIaaXh.js → quadrantDiagram-ABIIQ3AL-WcAQ7c3t.js} +1 -1
  45. package/dist/gui/assets/{railroadDiagram-RFXS5EU6-uDh6Eejs.js → railroadDiagram-RFXS5EU6-CvhuJF1y.js} +1 -1
  46. package/dist/gui/assets/{requirementDiagram-TGXJPOKE-mq71nhz4.js → requirementDiagram-TGXJPOKE-DOsKohKX.js} +1 -1
  47. package/dist/gui/assets/{sankeyDiagram-HTMAVEWB-hXTichtO.js → sankeyDiagram-HTMAVEWB-vLfbJPAx.js} +1 -1
  48. package/dist/gui/assets/{sequenceDiagram-DBY2YBRQ-CgITKOd_.js → sequenceDiagram-DBY2YBRQ-DxKy0CAM.js} +1 -1
  49. package/dist/gui/assets/{sizeCapture-X5ZJPWSS-Bg4phjBx.js → sizeCapture-X5ZJPWSS-BE5SU9rY.js} +1 -1
  50. package/dist/gui/assets/{stateDiagram-2N3HPSRC-DKBi1ceK.js → stateDiagram-2N3HPSRC-Ct8Gvq1y.js} +1 -1
  51. package/dist/gui/assets/stateDiagram-v2-6OUMAXLB-BZ2lYeO3.js +1 -0
  52. package/dist/gui/assets/{swimlanes-5IMT3BWC-BotNlXJq.js → swimlanes-5IMT3BWC-0c9e31Te.js} +2 -2
  53. package/dist/gui/assets/swimlanesDiagram-G3AALYLV-BLfYiUPF.js +8 -0
  54. package/dist/gui/assets/{timeline-definition-FHXFAJF6-xPORA673.js → timeline-definition-FHXFAJF6-D0m2eIpy.js} +1 -1
  55. package/dist/gui/assets/{vennDiagram-L72KCM5P-9lcR-L8Q.js → vennDiagram-L72KCM5P-BnM9fTPa.js} +1 -1
  56. package/dist/gui/assets/{wardleyDiagram-EHGQE667-CLRUHnek.js → wardleyDiagram-EHGQE667-BKyR-aXS.js} +1 -1
  57. package/dist/gui/assets/{xychartDiagram-FW5EYKEG-C-oJxiEj.js → xychartDiagram-FW5EYKEG-Dr3zUp02.js} +1 -1
  58. package/dist/gui/index.html +1 -1
  59. package/package.json +1 -1
  60. package/dist/gui/assets/channel-DjP6myfL.js +0 -1
  61. package/dist/gui/assets/classDiagram-OUVF2IWQ-CqIEE3-0.js +0 -1
  62. package/dist/gui/assets/classDiagram-v2-EOCWNBFH-CqIEE3-0.js +0 -1
  63. package/dist/gui/assets/stateDiagram-v2-6OUMAXLB-DSkELjnp.js +0 -1
  64. package/dist/gui/assets/swimlanesDiagram-G3AALYLV-_zGHZ8dn.js +0 -8
package/dist/cli/index.js CHANGED
@@ -5,7 +5,7 @@ import { stat, mkdir, writeFile, rename, readFile, rm, access, cp, readdir, appe
5
5
  import { join, isAbsolute, resolve, basename as basename$1, dirname, extname, relative, sep, normalize } from "node:path";
6
6
  import { createHash, randomUUID, randomBytes } from "node:crypto";
7
7
  import { existsSync, openSync, closeSync, statSync, readSync, mkdirSync, watch, createReadStream } from "node:fs";
8
- import { spawn, execFile, execFileSync } from "node:child_process";
8
+ import { execFile, spawn, execFileSync } from "node:child_process";
9
9
  import { promisify } from "node:util";
10
10
  import { serve } from "@hono/node-server";
11
11
  import { isIP } from "node:net";
@@ -23,7 +23,7 @@ import { createOpencode } from "@opencode-ai/sdk";
23
23
  import { createInterface as createInterface$1 } from "node:readline/promises";
24
24
  import MarkdownIt from "markdown-it";
25
25
  const name = "@yorz/cli";
26
- const version = "0.8.2";
26
+ const version = "0.8.3";
27
27
  const type = "module";
28
28
  const description = "";
29
29
  const bin = { "yorz": "./dist/cli/index.js" };
@@ -482,6 +482,23 @@ const __vite_glob_0_40 = '> **Warning**\n>\n> ## THIS IS AN AUTOGENERATED FILE.
482
482
  const __vite_glob_0_41 = '> **Warning**\n>\n> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.\n>\n> ## Please edit the corresponding file in [/packages/mermaid/src/docs/syntax/treemap.md](../../packages/mermaid/src/docs/syntax/treemap.md).\n\n# Treemap Diagram\n\n> A treemap diagram displays hierarchical data as a set of nested rectangles. Each branch of the tree is represented by a rectangle, which is then tiled with smaller rectangles representing sub-branches.\n\n> **Warning**\n> This is a new diagram type in Mermaid. Its syntax may evolve in future versions.\n\n## Introduction\n\nTreemap diagrams are an effective way to visualize hierarchical data and show proportions between categories and subcategories. The size of each rectangle is proportional to the value it represents, making it easy to compare different parts of a hierarchy.\n\nTreemap diagrams are particularly useful for:\n\n- Visualizing hierarchical data structures\n- Comparing proportions between categories\n- Displaying large amounts of hierarchical data in a limited space\n- Identifying patterns and outliers in hierarchical data\n\n## Syntax\n\n```\ntreemap-beta\n"Section 1"\n "Leaf 1.1": 12\n "Section 1.2"\n "Leaf 1.2.1": 12\n"Section 2"\n "Leaf 2.1": 20\n "Leaf 2.2": 25\n```\n\n### Node Definition\n\nNodes in a treemap are defined using the following syntax:\n\n- **Section/Parent nodes**: Defined with quoted text `"Section Name"`\n- **Leaf nodes with values**: Defined with quoted text followed by a colon and value `"Leaf Name": value`\n- **Hierarchy**: Created using indentation (spaces or tabs)\n- **Styling**: Nodes can be styled using the `:::class` syntax\n\n## Examples\n\n### Basic Treemap\n\n```mermaid-example\ntreemap-beta\n"Category A"\n "Item A1": 10\n "Item A2": 20\n"Category B"\n "Item B1": 15\n "Item B2": 25\n```\n\n```mermaid\ntreemap-beta\n"Category A"\n "Item A1": 10\n "Item A2": 20\n"Category B"\n "Item B1": 15\n "Item B2": 25\n```\n\n### Hierarchical Treemap\n\n```mermaid-example\ntreemap-beta\n"Products"\n "Electronics"\n "Phones": 50\n "Computers": 30\n "Accessories": 20\n "Clothing"\n "Men\'s": 40\n "Women\'s": 40\n```\n\n```mermaid\ntreemap-beta\n"Products"\n "Electronics"\n "Phones": 50\n "Computers": 30\n "Accessories": 20\n "Clothing"\n "Men\'s": 40\n "Women\'s": 40\n```\n\n### Treemap with Styling\n\n```mermaid-example\ntreemap-beta\n"Section 1"\n "Leaf 1.1": 12\n "Section 1.2":::class1\n "Leaf 1.2.1": 12\n"Section 2"\n "Leaf 2.1": 20:::class1\n "Leaf 2.2": 25\n "Leaf 2.3": 12\n\nclassDef class1 fill:red,color:blue,stroke:#FFD600;\n```\n\n```mermaid\ntreemap-beta\n"Section 1"\n "Leaf 1.1": 12\n "Section 1.2":::class1\n "Leaf 1.2.1": 12\n"Section 2"\n "Leaf 2.1": 20:::class1\n "Leaf 2.2": 25\n "Leaf 2.3": 12\n\nclassDef class1 fill:red,color:blue,stroke:#FFD600;\n```\n\n## Styling and Configuration\n\nTreemap diagrams can be customized using Mermaid\'s styling and configuration options.\n\n### Using classDef for Styling\n\nYou can define custom styles for nodes using the `classDef` syntax, which is a standard feature across many Mermaid diagram types:\n\n```mermaid-example\ntreemap-beta\n"Main"\n "A": 20\n "B":::important\n "B1": 10\n "B2": 15\n "C": 5\n\nclassDef important fill:#f96,stroke:#333,stroke-width:2px;\n```\n\n```mermaid\ntreemap-beta\n"Main"\n "A": 20\n "B":::important\n "B1": 10\n "B2": 15\n "C": 5\n\nclassDef important fill:#f96,stroke:#333,stroke-width:2px;\n```\n\n### Theme Configuration\n\nYou can customize the colors of your treemap using the theme configuration:\n\n```mermaid-example\n---\nconfig:\n theme: \'forest\'\n---\ntreemap-beta\n"Category A"\n "Item A1": 10\n "Item A2": 20\n"Category B"\n "Item B1": 15\n "Item B2": 25\n```\n\n```mermaid\n---\nconfig:\n theme: \'forest\'\n---\ntreemap-beta\n"Category A"\n "Item A1": 10\n "Item A2": 20\n"Category B"\n "Item B1": 15\n "Item B2": 25\n```\n\n### Diagram Padding\n\nYou can adjust the padding around the treemap diagram using the `diagramPadding` configuration option:\n\n```mermaid-example\n---\nconfig:\n treemap:\n diagramPadding: 200\n---\ntreemap-beta\n"Category A"\n "Item A1": 10\n "Item A2": 20\n"Category B"\n "Item B1": 15\n "Item B2": 25\n```\n\n```mermaid\n---\nconfig:\n treemap:\n diagramPadding: 200\n---\ntreemap-beta\n"Category A"\n "Item A1": 10\n "Item A2": 20\n"Category B"\n "Item B1": 15\n "Item B2": 25\n```\n\n## Configuration Options\n\nThe treemap diagram supports the following configuration options:\n\n| Option | Description | Default |\n| -------------- | --------------------------------------------------------------------------- | ------- |\n| useMaxWidth | When true, the diagram width is set to 100% and scales with available space | true |\n| padding | Internal padding between nodes | 10 |\n| diagramPadding | Padding around the entire diagram | 8 |\n| showValues | Whether to show values in the treemap | true |\n| nodeWidth | Width of nodes | 100 |\n| nodeHeight | Height of nodes | 40 |\n| borderWidth | Width of borders | 1 |\n| valueFontSize | Font size for values | 12 |\n| labelFontSize | Font size for labels | 14 |\n| valueFormat | Format for values (see Value Formatting section) | \',\' |\n\n## Advanced Features\n\n### Value Formatting\n\nValues in treemap diagrams can be formatted to display in different ways using the `valueFormat` configuration option. This option primarily uses [D3\'s format specifiers](https://github.com/d3/d3-format#locale_format) to control how numbers are displayed, with some additional special cases for common formats.\n\nSome common format patterns:\n\n- `,` - Thousands separator (default)\n- `$` - Add dollar sign\n- `.1f` - Show one decimal place\n- `.1%` - Show as percentage with one decimal place\n- `$0,0` - Dollar sign with thousands separator\n- `$.2f` - Dollar sign with 2 decimal places\n- `$,.2f` - Dollar sign with thousands separator and 2 decimal places\n\nThe treemap diagram supports both standard D3 format specifiers and some common currency formats that combine the dollar sign with other formatting options.\n\nExample with currency formatting:\n\n```mermaid-example\n---\nconfig:\n treemap:\n valueFormat: \'$0,0\'\n---\ntreemap-beta\n"Budget"\n "Operations"\n "Salaries": 700000\n "Equipment": 200000\n "Supplies": 100000\n "Marketing"\n "Advertising": 400000\n "Events": 100000\n```\n\n```mermaid\n---\nconfig:\n treemap:\n valueFormat: \'$0,0\'\n---\ntreemap-beta\n"Budget"\n "Operations"\n "Salaries": 700000\n "Equipment": 200000\n "Supplies": 100000\n "Marketing"\n "Advertising": 400000\n "Events": 100000\n```\n\nExample with percentage formatting:\n\n```mermaid-example\n---\nconfig:\n treemap:\n valueFormat: \'$.1%\'\n---\ntreemap-beta\n"Market Share"\n "Company A": 0.35\n "Company B": 0.25\n "Company C": 0.15\n "Others": 0.25\n```\n\n```mermaid\n---\nconfig:\n treemap:\n valueFormat: \'$.1%\'\n---\ntreemap-beta\n"Market Share"\n "Company A": 0.35\n "Company B": 0.25\n "Company C": 0.15\n "Others": 0.25\n```\n\n## Common Use Cases\n\nTreemap diagrams are commonly used for:\n\n1. **Financial Data**: Visualizing budget allocations, market shares, or portfolio compositions\n2. **File System Analysis**: Showing disk space usage by folders and files\n3. **Population Demographics**: Displaying population distribution across regions and subregions\n4. **Product Hierarchies**: Visualizing product categories and their sales volumes\n5. **Organizational Structures**: Representing departments and team sizes in a company\n\n## Limitations\n\n- Treemap diagrams work best when the data has a natural hierarchy\n- Very small values may be difficult to see or label in a treemap diagram\n- Deep hierarchies (many levels) can be challenging to represent clearly\n- Treemap diagrams are not well suited for representing data with negative values\n\n## Related Diagrams\n\nIf treemap diagrams don\'t suit your needs, consider these alternatives:\n\n- [**Pie Charts**](./pie.md): For simple proportion comparisons without hierarchy\n- **Sunburst Diagrams**: For hierarchical data with a radial layout (yet to be released in Mermaid).\n- [**Sankey Diagrams**](./sankey.md): For flow-based hierarchical data\n\n## Notes\n\nThe treemap diagram implementation in Mermaid is designed to be simple to use while providing powerful visualization capabilities. As this is a newer diagram type, feedback and feature requests are welcome through the Mermaid GitHub repository.\n';
483
483
  const __vite_glob_0_42 = '> **Warning**\n>\n> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.\n>\n> ## Please edit the corresponding file in [/packages/mermaid/src/docs/syntax/xyChart.md](../../packages/mermaid/src/docs/syntax/xyChart.md).\n\n# XY Chart\n\n> In the context of mermaid-js, the XY chart is a comprehensive charting module that encompasses various types of charts that utilize both x-axis and y-axis for data representation. Presently, it includes two fundamental chart types: the bar chart and the line chart. These charts are designed to visually display and analyze data that involve two numerical variables.\n\n> It\'s important to note that while the current implementation of mermaid-js includes these two chart types, the framework is designed to be dynamic and adaptable. Therefore, it has the capacity for expansion and the inclusion of additional chart types in the future. This means that users can expect an evolving suite of charting options within the XY chart module, catering to various data visualization needs as new chart types are introduced over time.\n\n## Example\n\n```mermaid-example\nxychart\n title "Sales Revenue"\n x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]\n y-axis "Revenue (in $)" 4000 --> 11000\n bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]\n line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]\n```\n\n```mermaid\nxychart\n title "Sales Revenue"\n x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]\n y-axis "Revenue (in $)" 4000 --> 11000\n bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]\n line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]\n```\n\n## Syntax\n\n> **Note**\n> All text values that contain only one word can be written without `"`. If a text value has many words in it, specifically if it contains spaces, enclose the value in `"`\n\n### Orientations\n\nThe chart can be drawn horizontal or vertical, default value is vertical.\n\n```\nxychart horizontal\n...\n```\n\n### Title\n\nThe title is a short description of the chart and it will always render on top of the chart.\n\n#### Example\n\n```\nxychart\n title "This is a simple example"\n ...\n```\n\n> **Note**\n> If the title is a single word one no need to use `"`, but if it has space `"` is needed\n\n### x-axis\n\nThe x-axis primarily serves as a categorical value, although it can also function as a numeric range value when needed.\n\n#### Example\n\n1. `x-axis title min --> max` x-axis will function as numeric with the given range\n2. `x-axis "title with space" [cat1, "cat2 with space", cat3]` x-axis if categorical, categories are text type\n\n### y-axis\n\nThe y-axis is employed to represent numerical range values, it cannot have categorical values.\n\n#### Example\n\n1. `y-axis title min --> max`\n2. `y-axis title` it will only add the title, the range will be auto generated from data.\n\n> **Note**\n> Both x and y axis are optional if not provided we will try to create the range\n\n### Line chart\n\nA line chart offers the capability to graphically depict lines.\n\n#### Example\n\n1. `line [2.3, 45, .98, -3.4]` it can have all valid numeric values.\n2. `line "series name" [2.3, 45, .98, -3.4]` adds the line to the legend.\n\n### Bar chart\n\nA bar chart offers the capability to graphically depict bars.\n\n#### Example\n\n1. `bar [2.3, 45, .98, -3.4]` it can have all valid numeric values.\n2. `bar "series name" [2.3, 45, .98, -3.4]` adds the bar to the legend.\n\n### Legend (v\\<MERMAID_RELEASE_VERSION>+)\n\nNamed line and bar plots are automatically shown in a legend. Unnamed plots are omitted from the legend.\n\n```mermaid-example\nxychart-beta\n title "An Example Chart"\n x-axis ["90d", "60d", "30d", "7d", "1d", "Current"]\n y-axis "Seconds" 0 --> 198.2\n line "avg" [48.1, 41.5, 45.7, 72.8, 67.7, 59.9]\n line "p50" [38.2, 36.8, 39.7, 54.5, 49.0, 38.4]\n line "p95" [112.2, 75.3, 103.0, 177.0, 180.2, 109.4]\n```\n\n```mermaid\nxychart-beta\n title "An Example Chart"\n x-axis ["90d", "60d", "30d", "7d", "1d", "Current"]\n y-axis "Seconds" 0 --> 198.2\n line "avg" [48.1, 41.5, 45.7, 72.8, 67.7, 59.9]\n line "p50" [38.2, 36.8, 39.7, 54.5, 49.0, 38.4]\n line "p95" [112.2, 75.3, 103.0, 177.0, 180.2, 109.4]\n```\n\n#### Simplest example\n\nThe only two things required are the chart name (`xychart`) and one data set. So you will be able to draw a chart with a simple config like\n\n```\nxychart\n line [+1.3, .6, 2.4, -.34]\n```\n\n## Chart Configurations\n\n| Parameter | Description | Default value |\n| ------------------------ | ------------------------------------------------------------- | :-----------: |\n| width | Width of the chart | 700 |\n| height | Height of the chart | 500 |\n| titlePadding | Top and Bottom padding of the title | 10 |\n| titleFontSize | Title font size | 20 |\n| showTitle | Title to be shown or not | true |\n| showLegend | Legend to be shown for named plots or not | true |\n| legendFontSize | Legend font size | 14 |\n| legendPadding | Padding around the legend | 10 |\n| xAxis | xAxis configuration | AxisConfig |\n| yAxis | yAxis configuration | AxisConfig |\n| chartOrientation | \'vertical\' or \'horizontal\' | \'vertical\' |\n| plotReservedSpacePercent | Minimum space plots will take inside the chart | 50 |\n| showDataLabel | Should show the value corresponding to the bar within the bar | false |\n| showDataLabelOutsideBar | If showing data label then show it outside the bar. | false |\n\n### AxisConfig\n\n| Parameter | Description | Default value |\n| ------------- | ------------------------------------------------------------ | :-----------: |\n| showLabel | Show axis labels or tick values | true |\n| labelFontSize | Font size of the label to be drawn | 14 |\n| labelPadding | Top and Bottom padding of the label | 5 |\n| showTitle | Axis title to be shown or not | true |\n| titleFontSize | Axis title font size | 16 |\n| titlePadding | Top and Bottom padding of Axis title | 5 |\n| showTick | Tick to be shown or not | true |\n| tickLength | How long the tick will be | 5 |\n| tickWidth | How width the tick will be | 2 |\n| showAxisLine | Axis line to be shown or not | true |\n| axisLineWidth | Thickness of the axis line | 2 |\n| labelRotation | Label rotation in degrees (only applicable on bottom X axis) | 0 |\n\n## Chart Theme Variables\n\nThemes for xychart reside inside the `xychart` attribute, allowing customization through the following syntax:\n\n```yaml\n---\nconfig:\n themeVariables:\n xyChart:\n titleColor: \'#ff0000\'\n---\n```\n\n| Parameter | Description |\n| ---------------- | --------------------------------------------------------- |\n| backgroundColor | Background color of the whole chart |\n| titleColor | Color of the Title text |\n| dataLabelColor | Color of the Data labels (if shown) |\n| legendTextColor | Color of the legend text |\n| xAxisLabelColor | Color of the x-axis labels |\n| xAxisTitleColor | Color of the x-axis title |\n| xAxisTickColor | Color of the x-axis tick |\n| xAxisLineColor | Color of the x-axis line |\n| yAxisLabelColor | Color of the y-axis labels |\n| yAxisTitleColor | Color of the y-axis title |\n| yAxisTickColor | Color of the y-axis tick |\n| yAxisLineColor | Color of the y-axis line |\n| plotColorPalette | String of colors separated by comma e.g. "#f3456, #43445" |\n\n### Setting Colors for Lines and Bars\n\nTo set the color for lines and bars, use the `plotColorPalette` parameter. Colors in the palette will correspond sequentially to the elements in your chart (e.g., first bar/line will use the first color specified in the palette).\n\n```mermaid-example\n---\nconfig:\n themeVariables:\n xyChart:\n plotColorPalette: \'#000000, #0000FF, #00FF00, #FF0000\'\n---\nxychart\ntitle "Different Colors in xyChart"\nx-axis "categoriesX" ["Category 1", "Category 2", "Category 3", "Category 4"]\ny-axis "valuesY" 0 --> 50\n%% Black line\nline [10,20,30,40]\n%% Blue bar\nbar [20,30,25,35]\n%% Green bar\nbar [15,25,20,30]\n%% Red line\nline [5,15,25,35]\n```\n\n```mermaid\n---\nconfig:\n themeVariables:\n xyChart:\n plotColorPalette: \'#000000, #0000FF, #00FF00, #FF0000\'\n---\nxychart\ntitle "Different Colors in xyChart"\nx-axis "categoriesX" ["Category 1", "Category 2", "Category 3", "Category 4"]\ny-axis "valuesY" 0 --> 50\n%% Black line\nline [10,20,30,40]\n%% Blue bar\nbar [20,30,25,35]\n%% Green bar\nbar [15,25,20,30]\n%% Red line\nline [5,15,25,35]\n```\n\n## Displaying individual values on a bar chart (v11.14.0+)\n\nTo show the value corresponding to a bar specify `showDataLabel: true`.\n\n```mermaid-example\n---\nconfig:\n xyChart:\n showDataLabel: true\n---\nxychart\n title "Genres in top 100 book survey of 2025"\n x-axis [comedy, romance, mystery, crime, "non fiction", other]\n y-axis "Number of Books" 0 --> 30\n bar [12,2,20,25,17,24]\n```\n\n```mermaid\n---\nconfig:\n xyChart:\n showDataLabel: true\n---\nxychart\n title "Genres in top 100 book survey of 2025"\n x-axis [comedy, romance, mystery, crime, "non fiction", other]\n y-axis "Number of Books" 0 --> 30\n bar [12,2,20,25,17,24]\n```\n\nLabels are shown within the bar by default. To show the labels outside the bar, specify `showDataLabelOutsideBar: true`.\n\n```mermaid-example\n---\nconfig:\n xyChart:\n showDataLabel: true\n showDataLabelOutsideBar: true\n---\nxychart\n title "Genres in top 100 book survey of 2025"\n x-axis [comedy, romance, mystery, crime, "non fiction", other]\n y-axis "Number of Books" 0 --> 30\n bar [12,2,20,25,17,24]\n```\n\n```mermaid\n---\nconfig:\n xyChart:\n showDataLabel: true\n showDataLabelOutsideBar: true\n---\nxychart\n title "Genres in top 100 book survey of 2025"\n x-axis [comedy, romance, mystery, crime, "non fiction", other]\n y-axis "Number of Books" 0 --> 30\n bar [12,2,20,25,17,24]\n```\n\n## Per-point text labels for line charts (v\\<MERMAID_RELEASE_VERSION>+)\n\nEach data point in a `line` can optionally include a quoted string label after the numeric value. Labels render above points in vertical orientation, or to the right in horizontal orientation, using the line\'s stroke color.\n\n```mermaid-example\nxychart\n title "Smallest AI models scoring above 60% on MMLU"\n x-axis "Date" ["Apr 2022", "Feb 2023", "Jul 2023", "Sep 2023", "Apr 2024"]\n y-axis "Parameters (B)" 0 --> 600\n line [540 "PaLM", 65 "LLaMA-65B", 34 "Llama 2 34B", 7 "Mistral 7B", 3.8 "Phi-3-mini"]\n```\n\n```mermaid\nxychart\n title "Smallest AI models scoring above 60% on MMLU"\n x-axis "Date" ["Apr 2022", "Feb 2023", "Jul 2023", "Sep 2023", "Apr 2024"]\n y-axis "Parameters (B)" 0 --> 600\n line [540 "PaLM", 65 "LLaMA-65B", 34 "Llama 2 34B", 7 "Mistral 7B", 3.8 "Phi-3-mini"]\n```\n\nLabels are optional per point — you can mix labeled and unlabeled values:\n\n```mermaid-example\nxychart\n title "Quarterly Performance"\n x-axis [Q1, Q2, Q3, Q4]\n y-axis "Revenue ($M)" 0 --> 100\n line [25 "Launch", 45, 72, 90 "Target Hit"]\n```\n\n```mermaid\nxychart\n title "Quarterly Performance"\n x-axis [Q1, Q2, Q3, Q4]\n y-axis "Revenue ($M)" 0 --> 100\n line [25 "Launch", 45, 72, 90 "Target Hit"]\n```\n\nExisting syntax without labels continues to work unchanged.\n\n> **Note**\n> Point labels use a fixed font size of 12px. In vertical charts, labels appear above each point. In horizontal charts, labels appear to the right. Labels are currently supported on `line` plots only; the syntax is accepted on `bar` plots but labels are ignored.\n\n## Example on config and theme\n\n```mermaid-example\n---\nconfig:\n xyChart:\n width: 900\n height: 600\n showDataLabel: true\n themeVariables:\n xyChart:\n titleColor: "#ff0000"\n---\nxychart\n title "Sales Revenue"\n x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]\n y-axis "Revenue (in $)" 4000 --> 11000\n bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]\n line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]\n```\n\n```mermaid\n---\nconfig:\n xyChart:\n width: 900\n height: 600\n showDataLabel: true\n themeVariables:\n xyChart:\n titleColor: "#ff0000"\n---\nxychart\n title "Sales Revenue"\n x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]\n y-axis "Revenue (in $)" 4000 --> 11000\n bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]\n line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]\n```\n';
484
484
  const __vite_glob_0_43 = '# 阶段流程(plan / tasks / execute / done / new-spec)\n\n## plan\n\n理解文档,分析现有代码,编写技术实现方案,更新到当前文档中;需要用户介入的事项以三级标题写入 `## 待确认项`,待用户后续审阅批注;暂时只需更新文档,不要实施代码。\n\n**目标:** 输出 `## 现状分析`、`## 技术实现方案`、`## 待确认项` 三节;禁止输出任务清单格式 `- [ ]`。\n\n若 `## 追加任务` 存在 `- [open] [feat|refct|fix] ...` 条目,必须将其纳入分析范围;plan 阶段不修改 `[open]` 状态标记。\n\n### 待确认项的三种类型\n\n一个待确认项,要么让用户**抉择**,要么让用户**确认**,要么请用户**自由补充**:\n\n| 类型 | 标记 | 语义 | 何时用 |\n| -------- | ------------------- | --------------------------------------------------------------------------------------- | --------------------- |\n| 抉择型 | `[choice]` | 给用户**选择权**:存在多个都可行、优劣取决于你拿不到的信息(业务优先级/外部约束)的方案 | 多方案差异大、难取舍 |\n| 确认型 | `[confirm]` | 给用户**否决权**:只有一个可行方案,但它有明显代价(技术债/影响面/不可逆) | 单方案但影响重大 |\n| 自由文本 | `(自由文本)` 后缀 | 请用户补一段开放说明 | 需要主观文案/开放意见 |\n\n> 无标记且带有序候选,向后兼容视为 `[choice]`。\n\n### 准入门槛(写入待确认项前必过的自检)\n\n**第一道过滤器先于类型判断**:这个答案,你能否通过读代码、跑测试、查项目约定自己确定?\n\n- **能** → 禁止写成待确认项,自己去查、去定,把决策+理由写进 `## 技术实现方案`(决策说明),不要打断用户。\n- **不能**(决策依赖用户独有信息,或选错的返工不可逆)→ 才写成待确认项,并归入 choice/confirm。\n\n> 待确认项是压力释放阀,不是免责声明。被你砍掉的判断不该凭空消失,要落成 `## 技术实现方案` 里的决策说明(决策 + 理由 + 被否决的备选)。\n\n### 抉择型 [choice] 正确示例\n\n```\n### 5.1 [choice] 候选答案的展现形式应采用哪种?\n1. 嵌套子列表\n2. 表格 (推荐)\n```\n\n- 候选写一级有序列表;恰 1 个候选以 ` (推荐)` / ` (推荐)` 结尾。\n- 空态与格式由 lint 的 `pending-questions/*` 规则保证。\n\n### 确认型 [confirm] 正确示例\n\n```\n### 5.2 [confirm] 将 UserID 从 int 迁移为 uuid\n\n**方案**:一次性迁移,双写过渡 2 周。\n**影响**:🔴 需停机窗口;对外 /api/user 字段类型变更,客户端需同步。\n```\n\n- 只有 `**方案**` 与 `**影响**`(或 `**代价**`)两字段,**不列候选**。\n- 影响行用红/黄语义标注严重度:🔴 breaking(破坏性/不可逆)、🟡 affected(有影响但可控)。\n- 确认型 = "我要这么干了,除非你喊停" 的知会 + 急停按钮:放行是常态,用户否决才是例外。\n\n### 确认型的否决语义(用户在 GUI 上如何回应)\n\n用户对确认型只有两种回应:**确认放行** 或 **否决**。否决必须携带理由,并细分意图(GUI 渲染为嵌套单选):\n\n| 用户决策 | 回写 `!!!选择:…` | 含义 |\n| ------------------------- | ------------------------------------ | ---------------------- |\n| 确认,按此推进 | `确认,按此推进` | 接受代价,继续 |\n| 否决·换方案 | `否决·换方案` | 原目标下另寻实现 |\n| 否决·补约束 | `否决·补约束` | 用户补充你漏掉的硬约束 |\n| 否决·弃目标·废弃当前目标 | `否决·弃目标·废弃当前目标,继续其余` | 该目标不做,其余照旧 |\n| 否决·弃目标·放弃整个 spec | `否决·弃目标·放弃整个 spec` | 整条 spec 作废 |\n\n> 决策不改动 API:编码进批注的 `选择:…`(结构化意图)+ `备注:…`(理由)。tasks 阶段按下表消费。\n\n### 图形化补充(plan 收尾子步骤)\n\n方案文字定稿后、结束 plan 前,**必须**专门回看 `## 现状分析`、`## 技术实现方案` 两节做一次 mermaid 图形化补充(仅此两节,其它章节不动):\n\n- 加载 [mermaid.md](./mermaid.md),先服从其**核心原则「图优先、精确信息折叠」**:表层给图(认知层),精确细节(路径、行号、类型/源码全文)折叠进 `<details>` 精确层,图与折叠互补不重复。\n- 按选型表与「必须用图」触发词补图:分步/分支散文→flowchart,接口/类型定义→classDiagram;含「兼容性/影响范围」时出结构图并按红=breaking、黄=affected 语义配色。\n- 这是一道独立聚焦的工序(不新增 stage):把「想清楚方案 / 写成文字」与「回看补图」分开,避免图形化被跳过。补图完成后再结束 plan。\n\n### 待确认项自检(plan 收尾子步骤)\n\n方案与图形化定稿后、结束 plan 前,**必须**专门回看 `## 待确认项` 做一次自检(与「图形化补充」同构:把"写方案"与"回看校验"分开,避免自检被跳过):\n\n1. **准入过滤**:逐条问"能否自己查证?"——能则删除该条、把决策落进 `## 技术实现方案`(决策说明)。\n2. **类型归类**:留下的每条明确标 `[choice]` 或 `[confirm]`(或 `(自由文本)`);单一类型,不兼具。\n3. **确认型补影响**:每个 `[confirm]` 必带 `**方案**` 与 `**影响**`(红/黄语义);影响写不出来,说明它其实够不上确认型,降级或删除。\n\n自检完成后再结束 plan。\n\n空态整章仅一行斜体占位:\n\n```\n## 5. 待确认项\n\n_暂无_\n```\n\n> 格式由 lint 的 `pending-questions/*` 规则保证;不确定时运行 `yorz lint` 查看报错。\n\n## tasks\n\n根据批注内容(`!!!` 前缀)更新技术方案;审查批注是否正确解答了待确认项;若引入新增/扩展需求或新增 bug,切回 plan;若存在冲突或歧义,回退 plan 并写入待确认项后退出;否则将技术方案拆解为可执行任务,写入文档,然后进入 execute。\n\n### 批注消费规则\n\n- 读取并消费所有 `!!!` 批注,将批注意图合并进 `## 技术实现方案` 与 `## 任务清单`。\n- 处理完成后**删除对应 `!!!` 文本**,然后**整段删除** `## 用户批注` 章节。\n\n### 确认型答复的消费\n\n当批注含 `!!!选择:<决策>;备注:<理由>`(引用行的前缀 `待确认项`/`待确认问题` 皆可),按 `选择:` 分派下游行为,并**无论确认或否决都留痕**——在 `## 技术实现方案` 追加一行决策记录:`> 决策记录:<条目> —— 用户<决策>,理由:<理由>。`(决策记录不随 `## 用户批注` 删除而蒸发):\n\n| `选择:` | 下游行为 |\n| ---------------------------------- | ---------------------------------------------------------------------------------------------- |\n| 确认,按此推进 | 接受代价,落决策记录,继续拆任务 |\n| 否决·换方案 | 切回 plan:原目标下另寻实现(新方案可能又产生 choice/confirm) |\n| 否决·补约束 | 切回 plan:把理由当硬约束重算方案 |\n| 否决·弃目标·废弃当前目标,继续其余 | 从 `## 需求` 剔除该目标,落决策记录,继续其余目标 |\n| 否决·弃目标·放弃整个 spec | 落决策记录(作废),将 `stage` 置 `done` 终止,`last_action` 记「用户放弃整个 spec,标记终止」 |\n\n### 任务清单正确示例\n\n```\n## 6. 任务清单\n\n- [ ] 删除 src/foo.ts 中的 deprecatedFunc(验收:grep 无残留引用)\n- [ ] 更新 index.ts 导出(验收:tsc --noEmit 通过)\n```\n\n> 每项任务包含"动作 + 对象 + 验收点";仅使用单层 `- [ ]`;禁止泛化任务。\n\n### `[manual]` 人工确认任务标记\n\n对「需人工确认、Agent 不能自动完成」的事项,用 `- [ ] [manual] ...` 标注:\n\n```\n- [ ] [manual] 联系运维确认灰度窗口(验收:人工回复确认)\n```\n\n`done` 收尾判定**忽略**未勾选的 `[manual]` 项:只要其余非 manual 任务全部完成,即可收尾为 `done`,无需等待人工项被勾选(详见 execute 的「收尾为 done」)。\n\n### 自动衔接\n\n> 任务量不构成暂停理由:以下衔接规则与任务清单长度、改动半径无关。\n\n若待确认项为 `_暂无_` 且无新冲突,同一轮继续进入 execute,**同一轮衔接 execute 前后不得**向用户追加任何"是否执行/是否继续"询问。\n\n## execute\n\n顺序执行 `## 任务清单` 中未完成项(`- [ ]`)。执行中若发现新增/扩展需求或新增 bug,立即停止,切回 plan。\n\n> **执行过程中不得对用户做整批/中段元确认**:除"新需求/新 bug → 切回 plan"这一合法阻塞外,任务清单内部的任何疑问都必须以 `## 待确认项` 形式写回触发重开,禁止追加"是否继续 / 我是否应该执行下一项"等问句停顿。\n\n### 每完成一项后立刻\n\n- 将该项从 `- [ ]` 改为 `- [x]`。\n- 在 `## 执行记录` 增加一条结果(改动点、验证方式、阻塞项若有)。\n\n### 默认执行验证\n\n若仓库存在可用测试/构建命令,默认执行并记录结果;若当前环境无法执行,记录原因。\n\n### 追加任务 `[open] → [fixed]` 状态机\n\n若本轮起因是 `## 追加任务` 中的 `[open]` 条目:每完成一个追加项,把状态标记从 `[open]` 改为 `[fixed]`(位置和正文保留不变),在 `## 执行记录` 追加一条结果。已 `[fixed]` 的条目保留作为历史,不删除。\n\n### 收尾为 done\n\n当 `## 任务清单` 不存在未完成的**非 `[manual]`** 任务(`- [ ] [manual]` 人工确认项被忽略),且 `## 待确认项` 为 `_暂无_`、无任何 `!!!` 批注、无 `## 追加任务` 的 `[open]` 条目时,在 execute 收尾同一轮:\n\n- 将 `stage` 置为 `done`,`last_action` 记「任务全部完成,标记 done」。\n- 在 `## 执行记录` 追加一条收尾条目。\n\n`done` 是终止态:机器 / GUI 可据 `stage=done` 直接判定完成。此后不再自动推进;收到新增/扩展需求、新 bug,或 `## 追加任务` 出现 `[open]` 时,按「变更重开流程」切回 `plan`。\n\n## new-spec\n\n当 `spec_path` 缺省且无法从 session 上下文恢复时,自动生成路径与初始骨架。\n\n### 步骤\n\n1. **提炼摘要**:从用户输入提炼 kebab-case `summary-name`(≤ 40 字符,不以数字开头,必须语义化):只使用对需求有语义代表性的英文/数字字符;中文为主难以提炼出可读 slug 时直接使用 `untitled-<NNN>`(3 位日期内自增编号)占位,**禁止把中文挤压为零散英文片段**(例如禁止出现 `spec-agent-spec-agent` 之类的拼接)。\n2. **判定 type**:`feat` / `refct` / `fix`;prompt 中已显式给出时直接使用;不确定时询问用户,兜底取 `feat`。\n3. **生成 id**:`YYMMDD.<type>.<summary-name>`(如 `260614.feat.spec-frontmatter`)。\n4. **生成路径**:`<specsDir>/<id>/spec.md`。id 冲突时追加 `-2`、`-3` 后缀。\n5. **初始化文档**:写入 frontmatter(`stage: plan`、`last_action: 新建 spec`、`updated_at` 本地秒级字符串、`summary` 为对需求的**真实概述**且 ≤ 200 字符,不要原样照搬整段需求);建议创建全部章节(背景 / 需求 / 现状分析 / 技术实现方案 / 待确认项 / 任务清单 / 执行记录),将用户原始需求写入背景或需求。\n6. **进入 plan**:初始化后在同一轮继续推进 plan,按 SKILL 规则补齐 `现状分析` / `技术实现方案` / `待确认项`,再视需要进入 tasks/execute;不要因为"文档已创建"就退出。\n\n### CLI 触发模式\n\nCLI/Service 同时给出 `类型:<type>` 与需求但未提供 `spec_path` 时,必须自动进入新建流程,不询问类型/路径;初始化后同一轮继续推进 plan,直到遇到真正阻塞才退出。\n';
485
+ const execFileP$1 = promisify(execFile);
486
+ function withHiddenWindowsConsole(options, platform2 = process.platform) {
487
+ if (platform2 !== "win32") return options;
488
+ return { ...options, windowsHide: true };
489
+ }
490
+ async function execFileWithoutWindow(file, args, options) {
491
+ const result = await execFileP$1(file, args, withHiddenWindowsConsole(options));
492
+ return { stdout: result.stdout, stderr: result.stderr };
493
+ }
494
+ function spawnWithoutWindow(command, args, options) {
495
+ return spawn(command, args, withHiddenWindowsConsole(options));
496
+ }
497
+ function resolveBrowserOpenInvocation(platform2, url) {
498
+ if (platform2 === "win32") return { command: "explorer.exe", args: [url] };
499
+ if (platform2 === "darwin") return { command: "open", args: [url] };
500
+ return { command: "xdg-open", args: [url] };
501
+ }
485
502
  async function isGitRepo(cwd) {
486
503
  try {
487
504
  await stat(join(cwd, ".git"));
@@ -492,7 +509,11 @@ async function isGitRepo(cwd) {
492
509
  }
493
510
  async function runGitInit(cwd) {
494
511
  await new Promise((resolve2, reject) => {
495
- const child = spawn("git", ["init"], { cwd, stdio: "inherit" });
512
+ const child = spawn(
513
+ "git",
514
+ ["init"],
515
+ withHiddenWindowsConsole({ cwd, stdio: "inherit" })
516
+ );
496
517
  child.on("error", reject);
497
518
  child.on("exit", (code) => {
498
519
  if (code === 0) resolve2();
@@ -2482,23 +2503,6 @@ function createSessionsRoutes(resolveProject) {
2482
2503
  });
2483
2504
  return app;
2484
2505
  }
2485
- const execFileP$2 = promisify(execFile);
2486
- function withHiddenWindowsConsole(options, platform2 = process.platform) {
2487
- if (platform2 !== "win32") return options;
2488
- return { ...options, windowsHide: true };
2489
- }
2490
- async function execFileWithoutWindow(file, args, options) {
2491
- const result = await execFileP$2(file, args, withHiddenWindowsConsole(options));
2492
- return { stdout: result.stdout, stderr: result.stderr };
2493
- }
2494
- function spawnWithoutWindow(command, args, options) {
2495
- return spawn(command, args, withHiddenWindowsConsole(options));
2496
- }
2497
- function resolveBrowserOpenInvocation(platform2, url) {
2498
- if (platform2 === "win32") return { command: "explorer.exe", args: [url] };
2499
- if (platform2 === "darwin") return { command: "open", args: [url] };
2500
- return { command: "xdg-open", args: [url] };
2501
- }
2502
2506
  class GitError extends Error {
2503
2507
  code;
2504
2508
  stderr;
@@ -2645,7 +2649,19 @@ async function commit(cwd, opts) {
2645
2649
  const extraPaths = renamed.map((r) => r.renamedFrom);
2646
2650
  const allPaths = [...opts.paths, ...extraPaths];
2647
2651
  await runGit(cwd, ["add", "--", ...allPaths]);
2648
- await runGit(cwd, ["commit", "-m", message]);
2652
+ const committed = await runGitRaw(cwd, ["commit", "-m", message]);
2653
+ if (committed.code !== 0) {
2654
+ const detail = `${committed.stdout}
2655
+ ${committed.stderr}`.trim();
2656
+ if (/nothing (added )?to commit|no changes added to commit/i.test(detail)) {
2657
+ throw new GitError(
2658
+ "nothing_to_commit",
2659
+ "selected paths have no staged changes — the file list is out of date, refresh and retry",
2660
+ detail
2661
+ );
2662
+ }
2663
+ throw new GitError("git_failed", "git commit failed", detail);
2664
+ }
2649
2665
  const { stdout } = await runGit(cwd, ["rev-parse", "HEAD"]);
2650
2666
  return { commit: stdout.trim() };
2651
2667
  }
@@ -2747,9 +2763,7 @@ async function listBranches(cwd) {
2747
2763
  ])
2748
2764
  ]);
2749
2765
  const branches = parseRefLines(branchesResult.stdout);
2750
- const remoteBranches = parseRefLines(remotesResult.stdout).filter(
2751
- (ref) => !ref.endsWith("/HEAD")
2752
- );
2766
+ const remoteBranches = parseRefLines(remotesResult.stdout).filter((ref) => !ref.endsWith("/HEAD"));
2753
2767
  return { current, branches, remoteBranches };
2754
2768
  }
2755
2769
  async function checkoutBranch(cwd, branch) {
@@ -2934,6 +2948,8 @@ function buildGitOpsPrompt(action, specId, specRel) {
2934
2948
  `;
2935
2949
  }
2936
2950
  }
2951
+ const MAX_STDERR_LINES = 6;
2952
+ const gitLog = () => getLogger().child("git");
2937
2953
  function createGitRoutes(resolveProject) {
2938
2954
  const app = new Hono();
2939
2955
  const need = async (c) => {
@@ -2952,13 +2968,26 @@ function createGitRoutes(resolveProject) {
2952
2968
  }
2953
2969
  };
2954
2970
  const toPaths = (value) => Array.isArray(value) ? value.filter((v) => typeof v === "string") : [];
2971
+ const gitFail = (c, err) => {
2972
+ const detail = err.stderr.trim().split("\n").slice(0, MAX_STDERR_LINES).join("\n");
2973
+ gitLog().warn("git command failed", {
2974
+ path: c.req.path,
2975
+ code: err.code,
2976
+ message: err.message,
2977
+ stderr: err.stderr.trim()
2978
+ });
2979
+ return c.json(
2980
+ { error: detail ? `${err.message}: ${detail}` : err.message, code: err.code },
2981
+ 400
2982
+ );
2983
+ };
2955
2984
  app.get("/projects/:projectId/git/changes", async (c) => {
2956
2985
  const p = await need(c);
2957
2986
  if (p instanceof Response) return p;
2958
2987
  try {
2959
2988
  return c.json({ changes: await listChanges(p.path) });
2960
2989
  } catch (err) {
2961
- if (err instanceof GitError) return c.json({ error: err.message }, 400);
2990
+ if (err instanceof GitError) return gitFail(c, err);
2962
2991
  throw err;
2963
2992
  }
2964
2993
  });
@@ -2970,7 +2999,7 @@ function createGitRoutes(resolveProject) {
2970
2999
  try {
2971
3000
  return c.json(await fileDiff(p.path, path));
2972
3001
  } catch (err) {
2973
- if (err instanceof GitError) return c.json({ error: err.message }, 400);
3002
+ if (err instanceof GitError) return gitFail(c, err);
2974
3003
  throw err;
2975
3004
  }
2976
3005
  });
@@ -2980,7 +3009,7 @@ function createGitRoutes(resolveProject) {
2980
3009
  try {
2981
3010
  return c.json(await listBranches(p.path));
2982
3011
  } catch (err) {
2983
- if (err instanceof GitError) return c.json({ error: err.message }, 400);
3012
+ if (err instanceof GitError) return gitFail(c, err);
2984
3013
  throw err;
2985
3014
  }
2986
3015
  });
@@ -2995,7 +3024,7 @@ function createGitRoutes(resolveProject) {
2995
3024
  const result = await checkoutBranch(p.path, branch);
2996
3025
  return c.json({ ok: true, ...result });
2997
3026
  } catch (err) {
2998
- if (err instanceof GitError) return c.json({ error: err.message }, 400);
3027
+ if (err instanceof GitError) return gitFail(c, err);
2999
3028
  throw err;
3000
3029
  }
3001
3030
  });
@@ -3010,7 +3039,7 @@ function createGitRoutes(resolveProject) {
3010
3039
  const result = await mergeBranch(p.path, branch);
3011
3040
  return c.json({ ok: true, ...result });
3012
3041
  } catch (err) {
3013
- if (err instanceof GitError) return c.json({ error: err.message }, 400);
3042
+ if (err instanceof GitError) return gitFail(c, err);
3014
3043
  throw err;
3015
3044
  }
3016
3045
  });
@@ -3026,7 +3055,7 @@ function createGitRoutes(resolveProject) {
3026
3055
  try {
3027
3056
  return c.json(await commit(p.path, { message, paths }));
3028
3057
  } catch (err) {
3029
- if (err instanceof GitError) return c.json({ error: err.message }, 400);
3058
+ if (err instanceof GitError) return gitFail(c, err);
3030
3059
  throw err;
3031
3060
  }
3032
3061
  });
@@ -3041,7 +3070,7 @@ function createGitRoutes(resolveProject) {
3041
3070
  await discard(p.path, { paths });
3042
3071
  return c.json({ ok: true });
3043
3072
  } catch (err) {
3044
- if (err instanceof GitError) return c.json({ error: err.message }, 400);
3073
+ if (err instanceof GitError) return gitFail(c, err);
3045
3074
  throw err;
3046
3075
  }
3047
3076
  });
@@ -3052,7 +3081,7 @@ function createGitRoutes(resolveProject) {
3052
3081
  const result = await push(p.path);
3053
3082
  return c.json({ ok: true, ...result });
3054
3083
  } catch (err) {
3055
- if (err instanceof GitError) return c.json({ error: err.message }, 400);
3084
+ if (err instanceof GitError) return gitFail(c, err);
3056
3085
  throw err;
3057
3086
  }
3058
3087
  });
@@ -3063,7 +3092,7 @@ function createGitRoutes(resolveProject) {
3063
3092
  const result = await pull(p.path);
3064
3093
  return c.json({ ok: true, ...result });
3065
3094
  } catch (err) {
3066
- if (err instanceof GitError) return c.json({ error: err.message }, 400);
3095
+ if (err instanceof GitError) return gitFail(c, err);
3067
3096
  throw err;
3068
3097
  }
3069
3098
  });
@@ -3604,7 +3633,8 @@ class PowerInhibitController {
3604
3633
  constructor(opts = {}) {
3605
3634
  this.globalConfigPath = opts.globalConfigPath;
3606
3635
  this.platform = opts.platform ?? platform();
3607
- this.spawnCommand = opts.spawnCommand ?? ((command, args, options) => spawn(command, args, options));
3636
+ this.spawnCommand = opts.spawnCommand ?? // win32 下经 withHiddenWindowsConsole 附加 windowsHide,避免 PowerShell 弹出可见控制台。
3637
+ ((command, args, options) => spawn(command, args, withHiddenWindowsConsole(options, this.platform)));
3608
3638
  }
3609
3639
  setSessionRunning(sessionId, running) {
3610
3640
  if (running) this.runningSessions.add(sessionId);
@@ -4469,18 +4499,22 @@ class CommandManager {
4469
4499
  return failed;
4470
4500
  }
4471
4501
  try {
4472
- const child = spawn(def.cli, {
4473
- shell: true,
4474
- cwd: this.projectPath,
4475
- env: process.env,
4476
- // POSIX 依赖独立进程组发送负 PID 信号;Windows 使用 taskkill /T,且 detached
4477
- // 会导致继承的日志文件描述符失效,所以 Windows 必须保持 attached。
4478
- detached: process.platform !== "win32",
4479
- // No pipes: the child writes straight into the log fd. Keeps a chatty
4480
- // dev server from buffering through this process, and lets the REST
4481
- // first paint and the SSE tail read from one single source.
4482
- stdio: ["ignore", fd, fd]
4483
- });
4502
+ const child = spawn(
4503
+ def.cli,
4504
+ // 显式传泛型,保留 stdio 元组在 SpawnOptions 上下文下的推断,避免重载解析失败。
4505
+ withHiddenWindowsConsole({
4506
+ shell: true,
4507
+ cwd: this.projectPath,
4508
+ env: process.env,
4509
+ // POSIX 依赖独立进程组发送负 PID 信号;Windows 使用 taskkill /T,且 detached
4510
+ // 会导致继承的日志文件描述符失效,所以 Windows 必须保持 attached。
4511
+ detached: process.platform !== "win32",
4512
+ // No pipes: the child writes straight into the log fd. Keeps a chatty
4513
+ // dev server from buffering through this process, and lets the REST
4514
+ // first paint and the SSE tail read from one single source.
4515
+ stdio: ["ignore", fd, fd]
4516
+ })
4517
+ );
4484
4518
  child.unref();
4485
4519
  const run = {
4486
4520
  runId,
@@ -6991,7 +7025,6 @@ class CodexAdapter {
6991
7025
  return null;
6992
7026
  }
6993
7027
  }
6994
- const execFileP$1 = promisify(execFile);
6995
7028
  const OPENCODE_QUOTA_INSTALL = "npx @slkiser/opencode-quota@latest init";
6996
7029
  const OPENCODE_QUOTA_PLUGIN_BIN = join(
6997
7030
  homedir(),
@@ -7248,8 +7281,9 @@ class OpenCodeAdapter {
7248
7281
  let lastError;
7249
7282
  for (const command of await opencodeQuotaCommands()) {
7250
7283
  try {
7251
- const { stdout } = await execFileP$1(command.cmd, command.args, {
7284
+ const { stdout } = await execFileWithoutWindow(command.cmd, command.args, {
7252
7285
  cwd: this.cwd,
7286
+ encoding: "utf8",
7253
7287
  timeout: 1e4,
7254
7288
  maxBuffer: 1024 * 1024
7255
7289
  });
@@ -8190,16 +8224,17 @@ function defaultRunUpdate() {
8190
8224
  }
8191
8225
  function defaultRunRestart() {
8192
8226
  const restart = resolveRestartCommand();
8193
- const child = spawn(restart.cmd, restart.args, {
8227
+ const child = spawnWithoutWindow(restart.cmd, restart.args, {
8194
8228
  detached: true,
8195
- stdio: "ignore"
8229
+ stdio: "ignore",
8230
+ ...process.platform === "win32" ? { shell: true } : {}
8196
8231
  });
8197
8232
  child.unref();
8198
8233
  return Promise.resolve();
8199
8234
  }
8200
8235
  function runProcess(cmd, args) {
8201
8236
  return new Promise((resolve2, reject) => {
8202
- const child = spawn(cmd, args, { stdio: "ignore" });
8237
+ const child = spawnWithoutWindow(cmd, args, { stdio: "ignore" });
8203
8238
  child.on("error", reject);
8204
8239
  child.on("exit", (code, signal) => {
8205
8240
  if (code === 0) resolve2();
@@ -8510,7 +8545,7 @@ async function runRestartServe(opts = {}) {
8510
8545
  }
8511
8546
  const entry = process.argv[1];
8512
8547
  if (!entry) throw new Error("Cannot resolve CLI entrypoint for restart");
8513
- const child = spawn(process.execPath, [entry, ...restartWorkerArgs(opts)], {
8548
+ const child = spawnWithoutWindow(process.execPath, [entry, ...restartWorkerArgs(opts)], {
8514
8549
  detached: true,
8515
8550
  stdio: "ignore"
8516
8551
  });
@@ -1 +1 @@
1
- import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-DkB3CKU9.js";import{p as f}from"./chunk-JWPE2WC7-BxQu3HdL.js";import{_ as n,l as o}from"./mermaid.core-Dy3NGXqh.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-2kv3gQiJ.js";import"./index-DakqmUCD.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},B={parser:R,db:a,renderer:u,styles:p};export{B as diagram};
1
+ import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-CuSjoqFP.js";import{p as f}from"./chunk-JWPE2WC7-CRJtNYf7.js";import{_ as n,l as o}from"./mermaid.core-DmUdNrWd.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-C5199IEw.js";import"./index-Auit67b0.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},B={parser:R,db:a,renderer:u,styles:p};export{B as diagram};
@@ -1 +1 @@
1
- import{Y as ln,$ as an,a0 as F,a1 as q,a2 as j,a3 as un,a4 as y,a5 as tn,a6 as J,a7 as _,a8 as rn,a9 as o,aa as on,ab as sn,ac as fn}from"./mermaid.core-Dy3NGXqh.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,z,a){var O=I-l,i=D-h,n=z-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function U(l,h,I,D,v,A,z){var a=l-I,O=h-D,i=(z?A:-A)/J(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,B=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*J(on(0,T*T*R-P*P)),Y=(P*g-m*S)/R,$=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=Y-B,e=$-t,r=w-B,C=p-t;return x*x+e*e>r*r+C*C&&(Y=w,$=p),{cx:Y,cy:$,x01:-n,y01:-d,x11:Y*(v/T-1),y11:$*(v/T-1)}}function hn(){var l=cn,h=yn,I=j(0),D=null,v=gn,A=dn,z=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,B=rn(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(B>tn-y)a.moveTo(s*F(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*F(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=B,S=B,Y=z.apply(this,arguments)/2,$=Y>y&&(D?+D.apply(this,arguments):J(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if($>y){var C=sn($/u*q(Y)),K=sn($/s*q(Y));(P-=C*2)>y?(C*=t?1:-1,R+=C,T-=C):(P=0,R=T=(f+c)/2),(S-=K*2)>y?(K*=t?1:-1,m+=K,g-=K):(S=0,m=g=(f+c)/2)}var G=s*F(m),H=s*q(m),L=u*F(T),M=u*q(T);if(w>y){var N=s*F(g),Q=s*q(g),V=u*F(R),W=u*q(R),E;if(B<an)if(E=pn(G,H,V,W,N,Q,L,M)){var X=G-E[0],Z=H-E[1],b=N-E[0],k=Q-E[1],nn=1/q(fn((X*b+Z*k)/(J(X*X+Z*Z)*J(b*b+k*k)))/2),en=J(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=U(V,W,G,H,s,x,t),r=U(N,Q,L,M,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(G,H),a.arc(0,0,s,m,g,!t)):a.moveTo(G,H),!(u>y)||!(P>y)?a.lineTo(L,M):p>y?(e=U(L,M,N,Q,u,-p,t),r=U(G,H,V,W,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[F(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:j(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:j(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:j(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:j(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:j(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:j(+n),i):A},i.padAngle=function(n){return arguments.length?(z=typeof n=="function"?n:j(+n),i):z},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
1
+ import{Y as ln,$ as an,a0 as F,a1 as q,a2 as j,a3 as un,a4 as y,a5 as tn,a6 as J,a7 as _,a8 as rn,a9 as o,aa as on,ab as sn,ac as fn}from"./mermaid.core-DmUdNrWd.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,z,a){var O=I-l,i=D-h,n=z-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function U(l,h,I,D,v,A,z){var a=l-I,O=h-D,i=(z?A:-A)/J(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,B=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*J(on(0,T*T*R-P*P)),Y=(P*g-m*S)/R,$=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=Y-B,e=$-t,r=w-B,C=p-t;return x*x+e*e>r*r+C*C&&(Y=w,$=p),{cx:Y,cy:$,x01:-n,y01:-d,x11:Y*(v/T-1),y11:$*(v/T-1)}}function hn(){var l=cn,h=yn,I=j(0),D=null,v=gn,A=dn,z=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,B=rn(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(B>tn-y)a.moveTo(s*F(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*F(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=B,S=B,Y=z.apply(this,arguments)/2,$=Y>y&&(D?+D.apply(this,arguments):J(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if($>y){var C=sn($/u*q(Y)),K=sn($/s*q(Y));(P-=C*2)>y?(C*=t?1:-1,R+=C,T-=C):(P=0,R=T=(f+c)/2),(S-=K*2)>y?(K*=t?1:-1,m+=K,g-=K):(S=0,m=g=(f+c)/2)}var G=s*F(m),H=s*q(m),L=u*F(T),M=u*q(T);if(w>y){var N=s*F(g),Q=s*q(g),V=u*F(R),W=u*q(R),E;if(B<an)if(E=pn(G,H,V,W,N,Q,L,M)){var X=G-E[0],Z=H-E[1],b=N-E[0],k=Q-E[1],nn=1/q(fn((X*b+Z*k)/(J(X*X+Z*Z)*J(b*b+k*k)))/2),en=J(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=U(V,W,G,H,s,x,t),r=U(N,Q,L,M,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(G,H),a.arc(0,0,s,m,g,!t)):a.moveTo(G,H),!(u>y)||!(P>y)?a.lineTo(L,M):p>y?(e=U(L,M,N,Q,u,-p,t),r=U(G,H,V,W,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[F(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:j(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:j(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:j(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:j(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:j(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:j(+n),i):A},i.padAngle=function(n){return arguments.length?(z=typeof n=="function"?n:j(+n),i):z},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};