chamba 0.0.1 → 0.1.0
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/README.md +17 -1
- package/dist/cli.js +1190 -0
- package/dist/server.js +1675 -0
- package/inject/annotate.js +49 -0
- package/package.json +24 -3
- package/skill/README.md +12 -0
- package/skill/SKILL.md +213 -0
- package/web/assets/abnfDiagram-VRR7QNED-aw1_rWFY.js +1 -0
- package/web/assets/arc-BMhSK0Sy.js +1 -0
- package/web/assets/architectureDiagram-ZJ3FMSHR-BZDcNKY3.js +36 -0
- package/web/assets/blockDiagram-677ZJIJ3-CLVR_gtH.js +132 -0
- package/web/assets/c4Diagram-LMCZKHZV-YjWWkNOJ.js +10 -0
- package/web/assets/channel-8ymR7Shm.js +1 -0
- package/web/assets/chunk-2Q5K7J3B-Bd9qqRl0.js +1 -0
- package/web/assets/chunk-32BRIVSS-Cq9EhooX.js +1 -0
- package/web/assets/chunk-5VM5RSS4-DYxyelz5.js +15 -0
- package/web/assets/chunk-EX3LRPZG-COaiqIlv.js +231 -0
- package/web/assets/chunk-JWPE2WC7-CMWXKnkF.js +1 -0
- package/web/assets/chunk-MOJQB5TN-BRzAoPL7.js +88 -0
- package/web/assets/chunk-RYQCIY6F-BRght6pl.js +1 -0
- package/web/assets/chunk-V7JOEXUC-BlbCYGxG.js +206 -0
- package/web/assets/chunk-VR4S4FIN-CPoKxaoM.js +1 -0
- package/web/assets/chunk-XXDRQBXY-DeNDfu5r.js +1 -0
- package/web/assets/classDiagram-OUVF2IWQ-g3gy3kDO.js +1 -0
- package/web/assets/classDiagram-v2-EOCWNBFH-g3gy3kDO.js +1 -0
- package/web/assets/cose-bilkent-JH36ORCC-C_V1sCw0.js +1 -0
- package/web/assets/cynefin-VYW2F7L2-CtWqChj_.js +178 -0
- package/web/assets/cynefinDiagram-TSTJHNR4-Q0g7rhQg.js +62 -0
- package/web/assets/cytoscape.esm-DTSO7Bv0.js +331 -0
- package/web/assets/dagre-VKFMJZFB-spMt8V5o.js +4 -0
- package/web/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/web/assets/diagram-FQU43EPY-CF7kRW9U.js +3 -0
- package/web/assets/diagram-G47NLZAW-B-5ygaqt.js +24 -0
- package/web/assets/diagram-NH7WQ7WH-CdOGPV2-.js +24 -0
- package/web/assets/diagram-OA4YK3LP-D1_1pb2t.js +30 -0
- package/web/assets/diagram-WEI45ONY-gD_xjCgB.js +41 -0
- package/web/assets/ebnfDiagram-CCIWWBDH-aW4E-V1v.js +1 -0
- package/web/assets/erDiagram-Q63AITRT-BWndxFVg.js +85 -0
- package/web/assets/flowDiagram-23GEKE2U-CVc37qLo.js +156 -0
- package/web/assets/ganttDiagram-NO4QXBWP-DV-2BraZ.js +292 -0
- package/web/assets/gitGraphDiagram-IHSO6WYX-YCy7dADs.js +106 -0
- package/web/assets/graph-C9eacEi8.js +1 -0
- package/web/assets/highlighted-body-OFNGDK62-q_mVDG84.js +1 -0
- package/web/assets/index-BG6acTBk.css +1 -0
- package/web/assets/index-CBBSnvKL.js +335 -0
- package/web/assets/infoDiagram-FWYZ7A6U-ig4wRILz.js +2 -0
- package/web/assets/init-Gi6I4Gst.js +1 -0
- package/web/assets/ishikawaDiagram-FXEZZL3T-BE8nJNWr.js +70 -0
- package/web/assets/journeyDiagram-5HDEW3XC-_olL4LFF.js +139 -0
- package/web/assets/kanban-definition-HUTT4EX6-DTFmbw9d.js +89 -0
- package/web/assets/katex-C5jXJg4s.js +257 -0
- package/web/assets/layout-DEXfKzaS.js +1 -0
- package/web/assets/linear-CbmtQHdI.js +1 -0
- package/web/assets/map-Czzmt4hB.js +1 -0
- package/web/assets/mermaid.core-CyLpSBwh.js +314 -0
- package/web/assets/mindmap-definition-LN4V7U3C-BFXQ_blT.js +96 -0
- package/web/assets/ordinal-Cboi1Yqb.js +1 -0
- package/web/assets/pegDiagram-2B236MQR-BzFkomCY.js +1 -0
- package/web/assets/pieDiagram-ENE6RG2P-r6gWlwuV.js +39 -0
- package/web/assets/quadrantDiagram-ABIIQ3AL-DTFxtS0e.js +7 -0
- package/web/assets/railroadDiagram-RFXS5EU6-CbZAYLVe.js +1 -0
- package/web/assets/requirementDiagram-TGXJPOKE-DzGi5GvN.js +84 -0
- package/web/assets/sankeyDiagram-HTMAVEWB-CBWOwAUD.js +40 -0
- package/web/assets/sequenceDiagram-DBY2YBRQ-QX9rQ9ow.js +162 -0
- package/web/assets/sizeCapture-X5ZJPWSS-X8SU5JUW.js +1 -0
- package/web/assets/stateDiagram-2N3HPSRC-kQgWzKK8.js +1 -0
- package/web/assets/stateDiagram-v2-6OUMAXLB-2kXWc9Fv.js +1 -0
- package/web/assets/swimlanes-5IMT3BWC-eKT1_uaa.js +2 -0
- package/web/assets/swimlanesDiagram-G3AALYLV-B5i-k7ui.js +8 -0
- package/web/assets/timeline-definition-FHXFAJF6-BRKXt19C.js +120 -0
- package/web/assets/vennDiagram-L72KCM5P-C-mbeAXb.js +34 -0
- package/web/assets/wardleyDiagram-EHGQE667-Doojx4Uh.js +78 -0
- package/web/assets/xychartDiagram-FW5EYKEG-CQZh8Trp.js +7 -0
- package/web/index.html +13 -0
package/skill/SKILL.md
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: chamba
|
|
3
|
+
description: Open a browser workspace paired to this terminal session so the human can see rendered markdown, paste screenshots the agent can read, and point at UI - one shared conversation between the terminal agent and the browser. Use when the user says /chamba, asks to "open chamba", wants to share or receive images, or wants a visual workspace alongside the terminal.
|
|
4
|
+
when_to_use: The user typed /chamba, asked to open the chamba workspace, wants to paste or be shown an image/screenshot, or wants a browser surface paired with this terminal session.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# chamba
|
|
8
|
+
|
|
9
|
+
chamba pairs this terminal session with a browser workspace over one shared
|
|
10
|
+
conversation. The terminal stays home base; the browser is where the human reads
|
|
11
|
+
rendered markdown, pastes screenshots you can open, and points at UI. A pasted
|
|
12
|
+
image arrives as a real file path you can `Read`; anything you send back with a
|
|
13
|
+
file renders inline in their browser.
|
|
14
|
+
|
|
15
|
+
Every command is `npx chamba@latest <command>`. Conversation content prints on
|
|
16
|
+
stdout (what you read and act on); status and hints go to stderr, so a command's
|
|
17
|
+
stdout is just the messages. Using `@latest` resolves the newest published
|
|
18
|
+
version rather than a stale one npx may have cached.
|
|
19
|
+
|
|
20
|
+
## Opening a session
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
npx chamba@latest open --title "what this is about"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Optionally `--kind spec` for spec work (extra Draft/Mock/Diagram surfaces). This
|
|
27
|
+
prints a URL on stdout - give that URL to the human and ask them to open it. The
|
|
28
|
+
server starts automatically if it is not already running.
|
|
29
|
+
|
|
30
|
+
## The loop
|
|
31
|
+
|
|
32
|
+
After opening (or `attach`), wait for the human:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
npx chamba@latest poll
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`poll` blocks until there is something to read, then prints it and returns. Run it
|
|
39
|
+
again to keep waiting - it is safe to re-run (a batch re-delivers if you were
|
|
40
|
+
interrupted before acting). React to what each line says:
|
|
41
|
+
|
|
42
|
+
- A message from the human (`you: ...`): do the work, then answer with `reply`.
|
|
43
|
+
- An attachment line (` [file] name -> /abs/path`): that path is a real file on
|
|
44
|
+
disk. `Read` it (screenshots, mockups, logs) and act on what you see.
|
|
45
|
+
- An annotation batch (`you [N annotations]:`): the human pointed at elements in
|
|
46
|
+
the app tab. Each numbered item carries the comment, the `selector`, the `page`
|
|
47
|
+
and `viewport`, a `[shot]` screenshot path to `Read`, and - when the app is
|
|
48
|
+
React/Next - the `component:` name and its source `file:line`. Use the source
|
|
49
|
+
and selector to find the code, `Read` the shot to see the problem, fix each item,
|
|
50
|
+
then `reply`. (React 19 shows the component name but may omit `file:line` unless
|
|
51
|
+
the app opted into bippy's source tier; fall back to the selector then.)
|
|
52
|
+
- `· You moved to another session (<id>)`: the human switched sessions. Hand off
|
|
53
|
+
with `npx chamba@latest attach <id>`, then keep polling that one.
|
|
54
|
+
- `· Session ended`: the human handed back to the terminal. Stop polling and
|
|
55
|
+
resume terminal work.
|
|
56
|
+
|
|
57
|
+
## Replying
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
npx chamba@latest reply on it - here is the diff you asked about
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Send a file back (renders in their browser); text is optional alongside it:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
npx chamba@latest reply here's the chart --image /abs/path/to/chart.png
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Use `--file a,b` / `--image a,b` (comma-separated) for several files.
|
|
70
|
+
|
|
71
|
+
## Handing back
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
npx chamba@latest end
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Ends the session from the terminal (the browser goes read-only). The human can
|
|
78
|
+
also hand back from the browser, which you will see as `· Session ended` on your
|
|
79
|
+
next poll.
|
|
80
|
+
|
|
81
|
+
## Spec sessions
|
|
82
|
+
|
|
83
|
+
A spec session is chamba's deepest use: a structured interview that produces a
|
|
84
|
+
spec package - a canonical markdown draft, mockups, diagrams, and a decision log -
|
|
85
|
+
in the same shared thread and the same annotation system.
|
|
86
|
+
Open one with `--kind spec`:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
npx chamba@latest open --kind spec --title "checkout redesign spec"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
This unlocks three surface tabs beside "Your app" - Draft, Mock, Diagram - each
|
|
93
|
+
annotatable exactly like the app tab.
|
|
94
|
+
You drive the session from the terminal with four commands (`ask`, `decision`,
|
|
95
|
+
`artifact`, `export`); the human answers, points, and annotates from the browser.
|
|
96
|
+
|
|
97
|
+
### Intake: infer the kind of work, then confirm it
|
|
98
|
+
|
|
99
|
+
A spec session opens with a free-form dump - text, pasted images, files.
|
|
100
|
+
Read all of it, infer which of four kinds of spec work this is, and confirm your
|
|
101
|
+
read with the human before diving in (they can override).
|
|
102
|
+
Record the confirmed kind with `decision` so it is on the log.
|
|
103
|
+
|
|
104
|
+
The four kinds are behaviorally distinct - they change what you do, not just a label:
|
|
105
|
+
|
|
106
|
+
- **co-spec** - no spec exists yet; you build one from scratch.
|
|
107
|
+
Start wide (goals, users, constraints, what success means), then converge; most
|
|
108
|
+
of the work is net-new question cards and a draft that grows from nothing.
|
|
109
|
+
- **review** - a spec or feature already exists and the human wants it pressure-tested.
|
|
110
|
+
Read it first against the codebase, then lead with the gaps, contradictions, and
|
|
111
|
+
unstated assumptions you find rather than with open-ended questions.
|
|
112
|
+
- **refine** - a draft exists and is roughly right; the work is sharpening.
|
|
113
|
+
Hunt vague terms, underspecified edges, and missing error/empty/loading states,
|
|
114
|
+
then propose precise wording and confirm it.
|
|
115
|
+
- **feedback** - the human has a running thing and reactions to it.
|
|
116
|
+
Lean on the Your app tab and annotations: turn each pointed-at problem into a
|
|
117
|
+
decision and a draft revision.
|
|
118
|
+
|
|
119
|
+
### The interview doctrine
|
|
120
|
+
|
|
121
|
+
- Hunt ambiguity relentlessly; every vague term ("fast", "simple", "secure") is a
|
|
122
|
+
question waiting to be asked.
|
|
123
|
+
- Assume the highest standard: when you offer options, mark the one you would
|
|
124
|
+
choose as `recommended` and say why in its description.
|
|
125
|
+
- Give development cost low weight - prefer quality, simplicity, robustness,
|
|
126
|
+
scalability, and long-term maintainability; surface the trade-off and let the
|
|
127
|
+
human decide.
|
|
128
|
+
- Cross-reference every claim against the actual code as `path:line`; do not assert
|
|
129
|
+
what the codebase does from memory.
|
|
130
|
+
- Never let anything unresolved silently vanish: if you cannot get an answer,
|
|
131
|
+
record it as an `assumed` decision so it surfaces as an open question.
|
|
132
|
+
- The human can stop anytime; the card always carries a stop affordance, so honor it.
|
|
133
|
+
|
|
134
|
+
### Asking - question cards
|
|
135
|
+
|
|
136
|
+
Post a structured question with `ask`.
|
|
137
|
+
Options are structured (a label, a description, an optional `recommended` flag), so
|
|
138
|
+
the card is passed as JSON - inline via `--json` or as a file path positional:
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
npx chamba@latest ask --json '{
|
|
142
|
+
"question": "How should an expired checkout session behave?",
|
|
143
|
+
"options": [
|
|
144
|
+
{"label": "Silent refresh", "description": "Mint a new session, keep the cart, no interruption.", "recommended": true},
|
|
145
|
+
{"label": "Prompt to resume", "description": "Show a resume dialog before restoring the cart."},
|
|
146
|
+
{"label": "Hard reset", "description": "Discard the cart and start over."}
|
|
147
|
+
]
|
|
148
|
+
}'
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Offer as many options as the question genuinely has (up to six); do not pad to a
|
|
152
|
+
number, and do not collapse real choices to fit.
|
|
153
|
+
You never add a "let me type my own" option or a "leave a note" option: the card
|
|
154
|
+
always shows a free-text custom-answer field and always lets the human annotate
|
|
155
|
+
their choice, with voice on both.
|
|
156
|
+
The answer returns as a normal message on your next `poll` - there is no separate
|
|
157
|
+
answer command - and `ask` fills in the card id for you.
|
|
158
|
+
|
|
159
|
+
### Recording decisions
|
|
160
|
+
|
|
161
|
+
Every material choice goes on the decision log, marked `confirmed` (the human chose
|
|
162
|
+
it) or `assumed` (you chose it provisionally on their behalf):
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
npx chamba@latest decision --status confirmed --summary "Expired sessions refresh silently, cart preserved"
|
|
166
|
+
npx chamba@latest decision --status assumed --summary "Guest checkout is in scope" --detail "Unconfirmed; revisit before finalizing"
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
`assumed` entries are the ones that surface as open questions on export, so record
|
|
170
|
+
them honestly rather than guessing silently.
|
|
171
|
+
|
|
172
|
+
### Building artifacts - draft, mock, diagram
|
|
173
|
+
|
|
174
|
+
Publish a draft, mock, or diagram from a file with `artifact`; the matching surface
|
|
175
|
+
tab renders it, annotatable like the app:
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
npx chamba@latest artifact --kind draft --name spec --file /abs/spec.md
|
|
179
|
+
npx chamba@latest artifact --kind mock --name checkout --file /abs/checkout.html
|
|
180
|
+
npx chamba@latest artifact --kind diagram --name flow --file /abs/flow.mmd
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
- `draft` is markdown (rendered), `mock` is HTML (served sandboxed with the
|
|
184
|
+
annotation layer injected), `diagram` is mermaid.
|
|
185
|
+
- Build the draft live: re-post the same `--kind draft --name <name>` as you write,
|
|
186
|
+
and its tab reloads to the new revision each time - this is how the spec builds in
|
|
187
|
+
front of the human.
|
|
188
|
+
- Keep one draft name (e.g. `spec`) as the canonical draft; it becomes `spec.md` on
|
|
189
|
+
export, and any other draft names land in `assets/`.
|
|
190
|
+
- Mocks and diagrams are annotated through the same select -> comment -> card flow as
|
|
191
|
+
the app tab; a batch of mock annotations arrives on `poll` just like app ones.
|
|
192
|
+
|
|
193
|
+
### Exporting the package
|
|
194
|
+
|
|
195
|
+
Nothing leaves `.chamba/` automatically.
|
|
196
|
+
When the spec is ready to be official, copy the self-contained package to a
|
|
197
|
+
destination the human names (usually under `docs/`):
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
npx chamba@latest export docs/checkout-spec
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
This writes `spec.md` (the canonical draft), `assets/` (mocks and diagrams), and
|
|
204
|
+
`decisions.md` (the log, grouped confirmed vs. assumed/open).
|
|
205
|
+
|
|
206
|
+
## Notes
|
|
207
|
+
|
|
208
|
+
- All commands talk to a local server that shares this container; you never need a
|
|
209
|
+
host or port beyond the defaults.
|
|
210
|
+
- Presence is automatic: while you are parked in `poll`, the browser shows the
|
|
211
|
+
agent as here.
|
|
212
|
+
- Past sessions stay readable: `npx chamba@latest attach <id>` reloads any session's
|
|
213
|
+
recent history.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-BRzAoPL7.js";import{p as f}from"./chunk-JWPE2WC7-CMWXKnkF.js";import{_ as n,l as o}from"./mermaid.core-CyLpSBwh.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-CtWqChj_.js";import"./index-CBBSnvKL.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};
|
|
@@ -0,0 +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-CyLpSBwh.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};
|