@computesdk/loops 0.1.5 → 0.1.7

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 (69) hide show
  1. package/API.md +15 -1
  2. package/README.md +9 -0
  3. package/client.ts +2 -8
  4. package/dist/assets/{abnfDiagram-VCTEODGH-B9RuyvBD.js → abnfDiagram-VCTEODGH-BKE3wXte.js} +1 -1
  5. package/dist/assets/{arc-oSrRugMo.js → arc-C6ZC2rP7.js} +1 -1
  6. package/dist/assets/{architectureDiagram-5GKGNRK7-CEzHv5eh.js → architectureDiagram-5GKGNRK7-BP4EuLVY.js} +1 -1
  7. package/dist/assets/{blockDiagram-I7D4REHJ-B3sDGRLX.js → blockDiagram-I7D4REHJ-BLw7XXPz.js} +1 -1
  8. package/dist/assets/{c4Diagram-7LVT6UL2-D00KlNWl.js → c4Diagram-7LVT6UL2-Bx80SfZM.js} +1 -1
  9. package/dist/assets/channel-D148DRm1.js +1 -0
  10. package/dist/assets/{chunk-2Q5K7J3B-BN48Ke2K.js → chunk-2Q5K7J3B-BPBebY_E.js} +1 -1
  11. package/dist/assets/{chunk-5VM5RSS4-9sDw2Q8Q.js → chunk-5VM5RSS4-QL5btn2z.js} +1 -1
  12. package/dist/assets/{chunk-F27PBJKO-BhGYOTAs.js → chunk-F27PBJKO-DwZ1yutT.js} +1 -1
  13. package/dist/assets/{chunk-IMKFNOWR-B_ltGfuo.js → chunk-IMKFNOWR-D_oIgde6.js} +1 -1
  14. package/dist/assets/{chunk-JWPE2WC7-BTV5s7zl.js → chunk-JWPE2WC7-B7803oA6.js} +1 -1
  15. package/dist/assets/{chunk-POPQ4Y6H-BBbmsZMU.js → chunk-POPQ4Y6H-BVGDPtWK.js} +1 -1
  16. package/dist/assets/{chunk-SVP7TREG-BBVuPqvz.js → chunk-SVP7TREG-LBP3GH9l.js} +1 -1
  17. package/dist/assets/{chunk-TICWLB2K-DGOhII0-.js → chunk-TICWLB2K-BI5m3CJb.js} +1 -1
  18. package/dist/assets/{chunk-XXDRQBXY-O9n8jFl3.js → chunk-XXDRQBXY-kxt8MH_7.js} +1 -1
  19. package/dist/assets/classDiagram-ZZMXUADV-CncavLbb.js +1 -0
  20. package/dist/assets/classDiagram-v2-VYDZK3BY-CncavLbb.js +1 -0
  21. package/dist/assets/{cose-bilkent-JH36ORCC-Bg-fKdMW.js → cose-bilkent-JH36ORCC-9ujaMun3.js} +1 -1
  22. package/dist/assets/{cynefin-OW5HDTMX-C0JTyL1D.js → cynefin-OW5HDTMX-D-nWdDZr.js} +1 -1
  23. package/dist/assets/{cynefinDiagram-5FMLGOSQ-BKEcSvZC.js → cynefinDiagram-5FMLGOSQ-CI6Scxp6.js} +1 -1
  24. package/dist/assets/{dagre-GXQ25YYZ-CF35QAK7.js → dagre-GXQ25YYZ-B8xNwtVY.js} +1 -1
  25. package/dist/assets/{diagram-S7CK7UJ4-uYVv0n_8.js → diagram-S7CK7UJ4-CbG9exCu.js} +1 -1
  26. package/dist/assets/{diagram-UQ7AKVKN-gJyJsotV.js → diagram-UQ7AKVKN-DJEVVOdt.js} +1 -1
  27. package/dist/assets/{diagram-VSXAHHWV-CIbzn0k5.js → diagram-VSXAHHWV-DXqMiZ59.js} +1 -1
  28. package/dist/assets/{diagram-VX7I27RA-B3NSrsYt.js → diagram-VX7I27RA-BgUsFlGi.js} +1 -1
  29. package/dist/assets/{diagram-Z3DM3KII-Dtn85G8Z.js → diagram-Z3DM3KII-15W3Mbq6.js} +1 -1
  30. package/dist/assets/{ebnfDiagram-PWID7BFC-Bk3kpRQ6.js → ebnfDiagram-PWID7BFC-QnWuy49w.js} +1 -1
  31. package/dist/assets/{erDiagram-RLTQ6QDP-CQdpI2Az.js → erDiagram-RLTQ6QDP-CtFAKfHK.js} +1 -1
  32. package/dist/assets/{flowDiagram-HODETNUW-DFEdxXsx.js → flowDiagram-HODETNUW-BXiSgIdj.js} +1 -1
  33. package/dist/assets/{ganttDiagram-EL5Y4UJY-3M3mh5KH.js → ganttDiagram-EL5Y4UJY-0X4MJoKa.js} +1 -1
  34. package/dist/assets/{gitGraphDiagram-WWUBYQGX-D-VPIWMG.js → gitGraphDiagram-WWUBYQGX-D1RSU4p4.js} +1 -1
  35. package/dist/assets/{highlighted-body-JLMTFACH-CXpgazVU.js → highlighted-body-JLMTFACH-DJpqqoLg.js} +1 -1
  36. package/dist/assets/index-B3Ugq2o6.js +902 -0
  37. package/dist/assets/{infoDiagram-27XIBGKW-mtm2MQD4.js → infoDiagram-27XIBGKW-DHPDHcTh.js} +1 -1
  38. package/dist/assets/{ishikawaDiagram-5VMMS53U-CCnoKccg.js → ishikawaDiagram-5VMMS53U-BaYQe1ZZ.js} +1 -1
  39. package/dist/assets/{journeyDiagram-3NMN7TZE-DGGM7lRo.js → journeyDiagram-3NMN7TZE-gQ5s_wv1.js} +1 -1
  40. package/dist/assets/{kanban-definition-UXKFOSKX-BGmjik6L.js → kanban-definition-UXKFOSKX-BxwSa57H.js} +1 -1
  41. package/dist/assets/{layout-DMtoi_oP.js → layout-thi9yMYl.js} +1 -1
  42. package/dist/assets/{linear-B9xGDkRB.js → linear-C3tNDt0i.js} +1 -1
  43. package/dist/assets/{mindmap-definition-YA3MSWOX-VS9bTKR0.js → mindmap-definition-YA3MSWOX-D4R4OXev.js} +1 -1
  44. package/dist/assets/{pegDiagram-XKGWAZYB-_umSwImn.js → pegDiagram-XKGWAZYB-BnVd3_9Z.js} +1 -1
  45. package/dist/assets/{pieDiagram-E7YTZNPT-DwYDfmi7.js → pieDiagram-E7YTZNPT-CwX8mvdJ.js} +1 -1
  46. package/dist/assets/{quadrantDiagram-AXDQQJYC-DKU_Wsvy.js → quadrantDiagram-AXDQQJYC-CoiKagpY.js} +1 -1
  47. package/dist/assets/{railroadDiagram-O6MQD6OU-DXB5lt92.js → railroadDiagram-O6MQD6OU-DZCee713.js} +1 -1
  48. package/dist/assets/{requirementDiagram-BXWQKSXE-Dvnijc9_.js → requirementDiagram-BXWQKSXE-BCksgH3P.js} +1 -1
  49. package/dist/assets/{sankeyDiagram-P5KCCOFB-B0GfeizJ.js → sankeyDiagram-P5KCCOFB-B0xOVx2_.js} +1 -1
  50. package/dist/assets/{sequenceDiagram-WJ2MYXX4-UZPfweQ-.js → sequenceDiagram-WJ2MYXX4-8myX-w3k.js} +1 -1
  51. package/dist/assets/{sizeCapture-INFHLROL-CZMGAWQe.js → sizeCapture-INFHLROL-DtAA6XEA.js} +1 -1
  52. package/dist/assets/{stateDiagram-D77RDMKH-B3JpYCVK.js → stateDiagram-D77RDMKH-eNo1EA8t.js} +1 -1
  53. package/dist/assets/stateDiagram-v2-MP3YSRHH-BZn7zD-F.js +1 -0
  54. package/dist/assets/{swimlanes-42K2YHIH-CZcyw1wj.js → swimlanes-42K2YHIH-CuZGWGh2.js} +1 -1
  55. package/dist/assets/swimlanesDiagram-VR7AAH4N-BG9s9tCY.js +8 -0
  56. package/dist/assets/{timeline-definition-24CTP7MA-va5MgQAQ.js → timeline-definition-24CTP7MA-lyUBY_Xm.js} +1 -1
  57. package/dist/assets/{vennDiagram-4TSXK5OY-DolghlVs.js → vennDiagram-4TSXK5OY-BaFKzCtR.js} +1 -1
  58. package/dist/assets/{wardleyDiagram-VM6X3IG4-DjA12Q4V.js → wardleyDiagram-VM6X3IG4-DMcUcLi9.js} +1 -1
  59. package/dist/assets/{xychartDiagram-S5SC5T6Z-C0gKPjZI.js → xychartDiagram-S5SC5T6Z-BVotbEcG.js} +1 -1
  60. package/dist/index.html +1 -1
  61. package/dist/server.mjs +165 -47
  62. package/package.json +3 -3
  63. package/src/shared/types.ts +13 -1
  64. package/dist/assets/channel-d6swnjWD.js +0 -1
  65. package/dist/assets/classDiagram-ZZMXUADV-BIQ2Cra4.js +0 -1
  66. package/dist/assets/classDiagram-v2-VYDZK3BY-BIQ2Cra4.js +0 -1
  67. package/dist/assets/index-rRV0z5I8.js +0 -902
  68. package/dist/assets/stateDiagram-v2-MP3YSRHH-DcAN0ZgF.js +0 -1
  69. package/dist/assets/swimlanesDiagram-VR7AAH4N-ColO3r6O.js +0 -8
package/API.md CHANGED
@@ -77,7 +77,7 @@ reader (the client above does) so the token can travel in `Authorization`.
77
77
  | `POST /workspaces` | `{ path }` | open/reopen a directory on the server; absolute path or `~/`; canonical paths deduplicate aliases |
78
78
  | `POST /workspaces/remove` | `{ id }` | close a workspace tab; keep sessions, bindings, and running agents |
79
79
  | `POST /prompt` | `{ chat, text, behavior? }` | send a message; `behavior` is `steer`/`followUp` while running |
80
- | `POST /abort` | `{ chat }` | stop the active turn |
80
+ | `POST /abort` | `{ chat }` | request cancellation of this chat's parent turn; background loops are independent |
81
81
  | `POST /answer` | `{ chat, question, choice }` | answer a queued question (a "needs you" card) |
82
82
  | `POST /ui` | `{ chat, id, response }` | answer an extension dialog: `{ value }`, `{ confirmed }` or `{ cancelled }` |
83
83
  | `POST /steer` | `{ chat, run, action, … }` | engine actions, below |
@@ -102,6 +102,20 @@ reader (the client above does) so the token can travel in `Authorization`.
102
102
  `take` continues from an attempt even if the judge rejected it, `apply` lands the winner in the checkout and commits,
103
103
  `clean` frees the attempt worktrees (the winner's stays), `more` asks the agent for another round. Responses say
104
104
  `{"ok": true, "sent": "<disposition>"}`; `sent: "handled"` means an extension consumed the prompt and no run started.
105
+ `pick` is an alias for `take`; both require `attempt: "R1-bold"`, **not** the display letter or a `label` field.
106
+ The boundary rejects missing/invalid actions, IDs and required fields, unknown attempts, and runs belonging to another chat.
107
+ Apply and stop always address the exact requested run, never an implicit latest run.
108
+
109
+ Stop loop sends `/loop stop <run>` to the existing chat writer. In the pinned Pi runtime extension commands execute
110
+ before the busy-parent streaming queue, so this cancels a background run even during a long parent tool call.
111
+ Stop agent uses RPC `abort`; it neither terminates Pi nor stops unrelated chats/workspaces.
112
+ Both return acknowledgements, **not evidence of completion**. Keep a stopping state until the chat's streamed
113
+ `live` settles or the run's durable terminal state arrives. Errors are retryable; an interrupted/missing signal is
114
+ not proof of stopping. Budget/timeout failures, no usable candidates and incomplete judging are not successful Done results.
115
+
116
+ Snapshots also carry workspace-scoped `configErrors` (`{ ws, file, error }[]`). Invalid watched project JSON is
117
+ saved as `loops.json.invalid-<timestamp>` and the last accepted settings are restored when possible.
118
+ The server keeps running; fix the rejected text and save valid JSON to propose it again.
105
119
 
106
120
  ### Workspace and session invariants
107
121
 
package/README.md CHANGED
@@ -264,6 +264,15 @@ The buttons talk to the engine, not to a model: `/loop take`, `/loop apply`, `/l
264
264
  `/loop answer`. Anything that needs judgement ("two more rounds", "steer it this way") is sent to the agent as a message,
265
265
  because that is a decision the agent owns.
266
266
 
267
+ **Stop agent** aborts the current chat's parent turn. **Stop loop** cancels only the named background run, even while
268
+ the parent is busy; its worktrees stay. Both are visible in the conversation and selected-loop canvas (including
269
+ mobile), guard duplicate requests and show errors. Acknowledging a button does not mark work stopped: streamed
270
+ session state must confirm it. Missing signals, incomplete judging and budget/timeout failures are not labeled Done.
271
+ All run actions keep the exact selected run ID; attempt selection sends its durable name, not its A/B display letter.
272
+
273
+ Invalid watched `.pi/loops.json` no longer terminates the server. The rejected text is saved beside the config,
274
+ the last accepted settings are restored when possible, and a workspace-scoped error explains how to recover.
275
+
267
276
  ## Parity
268
277
 
269
278
  `npm run shots` writes `./shots/` at 1440, 1024 and 430 wide. The pass condition for this port was the screens the POC at
package/client.ts CHANGED
@@ -16,14 +16,8 @@ export type ClientOptions = {
16
16
  };
17
17
 
18
18
  /** What `steer` can do to a run. `more` asks the agent for another round; the rest are engine actions. */
19
- export type SteerAction =
20
- | { action: "take"; attempt: string }
21
- | { action: "apply" }
22
- | { action: "stop" }
23
- | { action: "clean" }
24
- | { action: "rule"; rule: string }
25
- | { action: "talk"; attempt: string; text: string }
26
- | { action: "more"; text?: number };
19
+ export type { SteerAction } from "./src/shared/types.ts";
20
+ import type { SteerAction } from "./src/shared/types.ts";
27
21
 
28
22
  export type EventHandlers = {
29
23
  /** The whole picture, every time something changes. Authoritative; `state.chat` is the chat you subscribed to. */
@@ -1 +1 @@
1
- import{g as p,r as u,d as a}from"./chunk-SVP7TREG-BBVuPqvz.js";import{p as f}from"./chunk-JWPE2WC7-BTV5s7zl.js";import{_ as n,l as o}from"./index-rRV0z5I8.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-C0JTyL1D.js";var v=d().RailroadAbnf.parser.LangiumParser,l=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("*"),i=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:i,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 l(e.element);case"AbnfOptionalGroup":return{type:"optional",element:l(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:l(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}},w={parser:R,db:a,renderer:u,styles:p};export{w as diagram};
1
+ import{g as p,r as u,d as a}from"./chunk-SVP7TREG-LBP3GH9l.js";import{p as f}from"./chunk-JWPE2WC7-B7803oA6.js";import{_ as n,l as o}from"./index-B3Ugq2o6.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-D-nWdDZr.js";var v=d().RailroadAbnf.parser.LangiumParser,l=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("*"),i=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:i,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 l(e.element);case"AbnfOptionalGroup":return{type:"optional",element:l(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:l(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}},w={parser:R,db:a,renderer:u,styles:p};export{w as diagram};
@@ -1 +1 @@
1
- import{K as ln,L as an,M as y,N as tn,O as X,P as O,Q as _,S as un,T as rn,V as $,X as o,Y as M,Z as sn,$ as on,a0 as fn}from"./index-rRV0z5I8.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,D,S,v,A,N,a){var E=D-l,i=S-h,n=N-v,d=a-A,u=d*E-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*E,h+u*i]}function G(l,h,D,S,v,A,N){var a=l-D,E=h-S,i=(N?A:-A)/$(a*a+E*E),n=i*E,d=-i*a,u=l+n,s=h+d,f=D+n,c=S+d,Q=(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,I=(g<0?-1:1)*$(fn(0,T*T*R-P*P)),K=(P*g-m*I)/R,L=(-P*m-g*I)/R,w=(P*g+m*I)/R,p=(-P*m+g*I)/R,x=K-Q,e=L-t,r=w-Q,V=p-t;return x*x+e*e>r*r+V*V&&(K=w,L=p),{cx:K,cy:L,x01:-n,y01:-d,x11:K*(v/T-1),y11:L*(v/T-1)}}function hn(){var l=cn,h=yn,D=M(0),S=null,v=gn,A=dn,N=mn,a=null,E=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=A.apply(this,arguments)-an,Q=un(c-f),t=c>f;if(a||(a=n=E()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(Q>tn-y)a.moveTo(s*X(f),s*O(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*X(c),u*O(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=Q,I=Q,K=N.apply(this,arguments)/2,L=K>y&&(S?+S.apply(this,arguments):$(u*u+s*s)),w=_(un(s-u)/2,+D.apply(this,arguments)),p=w,x=w,e,r;if(L>y){var V=sn(L/u*O(K)),j=sn(L/s*O(K));(P-=V*2)>y?(V*=t?1:-1,R+=V,T-=V):(P=0,R=T=(f+c)/2),(I-=j*2)>y?(j*=t?1:-1,m+=j,g-=j):(I=0,m=g=(f+c)/2)}var Y=s*X(m),Z=s*O(m),z=u*X(T),B=u*O(T);if(w>y){var C=s*X(g),F=s*O(g),H=u*X(R),J=u*O(R),q;if(Q<rn)if(q=pn(Y,Z,H,J,C,F,z,B)){var U=Y-q[0],W=Z-q[1],k=C-q[0],b=F-q[1],nn=1/O(on((U*k+W*b)/($(U*U+W*W)*$(k*k+b*b)))/2),en=$(q[0]*q[0]+q[1]*q[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}I>y?x>y?(e=G(H,J,Y,Z,s,x,t),r=G(C,F,z,B,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(Y,Z),a.arc(0,0,s,m,g,!t)):a.moveTo(Y,Z),!(u>y)||!(P>y)?a.lineTo(z,B):p>y?(e=G(z,B,C,F,u,-p,t),r=G(Y,Z,H,J,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-rn/2;return[X(d)*n,O(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:M(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:M(+n),i):h},i.cornerRadius=function(n){return arguments.length?(D=typeof n=="function"?n:M(+n),i):D},i.padRadius=function(n){return arguments.length?(S=n==null?null:typeof n=="function"?n:M(+n),i):S},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:M(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:M(+n),i):A},i.padAngle=function(n){return arguments.length?(N=typeof n=="function"?n:M(+n),i):N},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
1
+ import{K as ln,L as an,M as y,N as tn,O as X,P as O,Q as _,S as un,T as rn,V as $,X as o,Y as M,Z as sn,$ as on,a0 as fn}from"./index-B3Ugq2o6.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,D,S,v,A,N,a){var E=D-l,i=S-h,n=N-v,d=a-A,u=d*E-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*E,h+u*i]}function G(l,h,D,S,v,A,N){var a=l-D,E=h-S,i=(N?A:-A)/$(a*a+E*E),n=i*E,d=-i*a,u=l+n,s=h+d,f=D+n,c=S+d,Q=(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,I=(g<0?-1:1)*$(fn(0,T*T*R-P*P)),K=(P*g-m*I)/R,L=(-P*m-g*I)/R,w=(P*g+m*I)/R,p=(-P*m+g*I)/R,x=K-Q,e=L-t,r=w-Q,V=p-t;return x*x+e*e>r*r+V*V&&(K=w,L=p),{cx:K,cy:L,x01:-n,y01:-d,x11:K*(v/T-1),y11:L*(v/T-1)}}function hn(){var l=cn,h=yn,D=M(0),S=null,v=gn,A=dn,N=mn,a=null,E=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=A.apply(this,arguments)-an,Q=un(c-f),t=c>f;if(a||(a=n=E()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(Q>tn-y)a.moveTo(s*X(f),s*O(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*X(c),u*O(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=Q,I=Q,K=N.apply(this,arguments)/2,L=K>y&&(S?+S.apply(this,arguments):$(u*u+s*s)),w=_(un(s-u)/2,+D.apply(this,arguments)),p=w,x=w,e,r;if(L>y){var V=sn(L/u*O(K)),j=sn(L/s*O(K));(P-=V*2)>y?(V*=t?1:-1,R+=V,T-=V):(P=0,R=T=(f+c)/2),(I-=j*2)>y?(j*=t?1:-1,m+=j,g-=j):(I=0,m=g=(f+c)/2)}var Y=s*X(m),Z=s*O(m),z=u*X(T),B=u*O(T);if(w>y){var C=s*X(g),F=s*O(g),H=u*X(R),J=u*O(R),q;if(Q<rn)if(q=pn(Y,Z,H,J,C,F,z,B)){var U=Y-q[0],W=Z-q[1],k=C-q[0],b=F-q[1],nn=1/O(on((U*k+W*b)/($(U*U+W*W)*$(k*k+b*b)))/2),en=$(q[0]*q[0]+q[1]*q[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}I>y?x>y?(e=G(H,J,Y,Z,s,x,t),r=G(C,F,z,B,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(Y,Z),a.arc(0,0,s,m,g,!t)):a.moveTo(Y,Z),!(u>y)||!(P>y)?a.lineTo(z,B):p>y?(e=G(z,B,C,F,u,-p,t),r=G(Y,Z,H,J,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-rn/2;return[X(d)*n,O(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:M(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:M(+n),i):h},i.cornerRadius=function(n){return arguments.length?(D=typeof n=="function"?n:M(+n),i):D},i.padRadius=function(n){return arguments.length?(S=n==null?null:typeof n=="function"?n:M(+n),i):S},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:M(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:M(+n),i):A},i.padAngle=function(n){return arguments.length?(N=typeof n=="function"?n:M(+n),i):N},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};