@computesdk/loops 0.1.11 → 0.1.13
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 +9 -0
- package/bin/pi-default-extension.mjs +47 -0
- package/bin/pi-rpc.mjs +14 -0
- package/dist/assets/{abnfDiagram-VCTEODGH-DCYXdRzD.js → abnfDiagram-VCTEODGH-D2bigoxc.js} +1 -1
- package/dist/assets/{arc-C0Zv4bRf.js → arc-BZl7sgf7.js} +1 -1
- package/dist/assets/{architectureDiagram-5GKGNRK7-udHqlZFO.js → architectureDiagram-5GKGNRK7-BEVh04as.js} +1 -1
- package/dist/assets/{blockDiagram-I7D4REHJ-DkwphONO.js → blockDiagram-I7D4REHJ-BXHXs9X2.js} +1 -1
- package/dist/assets/{c4Diagram-7LVT6UL2-C0Qkqogh.js → c4Diagram-7LVT6UL2-BDJNDCcc.js} +1 -1
- package/dist/assets/channel-C47Lbhx6.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-BQDQoQmL.js → chunk-2Q5K7J3B-BdUkLQYN.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-CvqeMalj.js → chunk-5VM5RSS4-3N4vBacE.js} +1 -1
- package/dist/assets/{chunk-F27PBJKO-D_B9YCM7.js → chunk-F27PBJKO-ByjH2OJK.js} +1 -1
- package/dist/assets/{chunk-IMKFNOWR-BYIRSti2.js → chunk-IMKFNOWR-D8jAt4ka.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-BPJdwBVM.js → chunk-JWPE2WC7-B7DWQYA4.js} +1 -1
- package/dist/assets/{chunk-POPQ4Y6H-lztII1aN.js → chunk-POPQ4Y6H-D5nv_lqi.js} +1 -1
- package/dist/assets/{chunk-SVP7TREG-DoYdkbun.js → chunk-SVP7TREG-CBg3GrIs.js} +1 -1
- package/dist/assets/{chunk-TICWLB2K-CjnLsube.js → chunk-TICWLB2K-BL_wE86-.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-Jsq5tSht.js → chunk-XXDRQBXY-ipZwP-Tw.js} +1 -1
- package/dist/assets/classDiagram-ZZMXUADV-BkejU3Ym.js +1 -0
- package/dist/assets/classDiagram-v2-VYDZK3BY-BkejU3Ym.js +1 -0
- package/dist/assets/{cose-bilkent-JH36ORCC-BIP9YsAI.js → cose-bilkent-JH36ORCC-tIdDJe7h.js} +1 -1
- package/dist/assets/{cynefin-OW5HDTMX-wj1eU8-l.js → cynefin-OW5HDTMX-C5BZ6yCh.js} +1 -1
- package/dist/assets/{cynefinDiagram-5FMLGOSQ-DW6veCDh.js → cynefinDiagram-5FMLGOSQ-KZkQ_Fs5.js} +1 -1
- package/dist/assets/{dagre-GXQ25YYZ-ChQ1GCij.js → dagre-GXQ25YYZ-8g1xXz_z.js} +1 -1
- package/dist/assets/{diagram-S7CK7UJ4-B0pgpZ9e.js → diagram-S7CK7UJ4-Civ7O2b1.js} +1 -1
- package/dist/assets/{diagram-UQ7AKVKN-BoNV14ty.js → diagram-UQ7AKVKN-CsiklyIt.js} +1 -1
- package/dist/assets/{diagram-VSXAHHWV-CpDQf6Z1.js → diagram-VSXAHHWV-eXAMoOzJ.js} +1 -1
- package/dist/assets/{diagram-VX7I27RA-BzTGDavi.js → diagram-VX7I27RA-Bb913WNj.js} +1 -1
- package/dist/assets/{diagram-Z3DM3KII-B5bOyrqx.js → diagram-Z3DM3KII-CiGD7-UB.js} +1 -1
- package/dist/assets/{ebnfDiagram-PWID7BFC-z4WVJ94j.js → ebnfDiagram-PWID7BFC-DFPxxkTf.js} +1 -1
- package/dist/assets/{erDiagram-RLTQ6QDP-iCda9mWB.js → erDiagram-RLTQ6QDP-DkPhQteJ.js} +1 -1
- package/dist/assets/{flowDiagram-HODETNUW-DGAIDu__.js → flowDiagram-HODETNUW-B8DTvq1w.js} +1 -1
- package/dist/assets/{ganttDiagram-EL5Y4UJY-C_TD7p_8.js → ganttDiagram-EL5Y4UJY-DPfnHIkg.js} +1 -1
- package/dist/assets/{gitGraphDiagram-WWUBYQGX-BhyVS4hu.js → gitGraphDiagram-WWUBYQGX-BzYuJVan.js} +1 -1
- package/dist/assets/{highlighted-body-JLMTFACH-DmjzCqfz.js → highlighted-body-JLMTFACH-D3y_nfFu.js} +1 -1
- package/dist/assets/{index-Cfkb4x7R.js → index-DvyWv1zp.js} +147 -147
- package/dist/assets/{index-D-CIRYJ5.css → index-vH6Ei526.css} +1 -1
- package/dist/assets/{infoDiagram-27XIBGKW-VKT9hRl2.js → infoDiagram-27XIBGKW-BCF2o-MF.js} +1 -1
- package/dist/assets/{ishikawaDiagram-5VMMS53U-CTbJYQrg.js → ishikawaDiagram-5VMMS53U-CNe6ETgR.js} +1 -1
- package/dist/assets/{journeyDiagram-3NMN7TZE-CuRQRZVc.js → journeyDiagram-3NMN7TZE-BVF1wnNZ.js} +1 -1
- package/dist/assets/{kanban-definition-UXKFOSKX-ConV4y36.js → kanban-definition-UXKFOSKX-CiWrBpoV.js} +1 -1
- package/dist/assets/{layout-dfLpQ9-g.js → layout-B2YGfZNT.js} +1 -1
- package/dist/assets/{linear-jzcXY-L-.js → linear-CecQQcNl.js} +1 -1
- package/dist/assets/{mindmap-definition-YA3MSWOX-BZ44_mmM.js → mindmap-definition-YA3MSWOX-CTRfx8rM.js} +1 -1
- package/dist/assets/{pegDiagram-XKGWAZYB-qwQPRnqR.js → pegDiagram-XKGWAZYB-BW5JUykP.js} +1 -1
- package/dist/assets/{pieDiagram-E7YTZNPT-C41zts6x.js → pieDiagram-E7YTZNPT-rtJftIcC.js} +1 -1
- package/dist/assets/{quadrantDiagram-AXDQQJYC-Bz7te34m.js → quadrantDiagram-AXDQQJYC-C2DaPj2w.js} +1 -1
- package/dist/assets/{railroadDiagram-O6MQD6OU-DQYw8Oka.js → railroadDiagram-O6MQD6OU-CcPfXEFl.js} +1 -1
- package/dist/assets/{requirementDiagram-BXWQKSXE-C-WJyiUK.js → requirementDiagram-BXWQKSXE-ozaClcIW.js} +1 -1
- package/dist/assets/{sankeyDiagram-P5KCCOFB-BikqKGtk.js → sankeyDiagram-P5KCCOFB-74tHF7mP.js} +1 -1
- package/dist/assets/{sequenceDiagram-WJ2MYXX4-009Ku6v1.js → sequenceDiagram-WJ2MYXX4-CTexKnGo.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-BtG1hGpf.js → sizeCapture-INFHLROL-2kVX0pT9.js} +1 -1
- package/dist/assets/{stateDiagram-D77RDMKH-BX2Uia62.js → stateDiagram-D77RDMKH-CgAkifQk.js} +1 -1
- package/dist/assets/stateDiagram-v2-MP3YSRHH-CH_iWHXT.js +1 -0
- package/dist/assets/{swimlanes-42K2YHIH-oE_h5Q_J.js → swimlanes-42K2YHIH-B-p2fQK8.js} +1 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-BVcRccxJ.js +8 -0
- package/dist/assets/{timeline-definition-24CTP7MA-tmMXsAa-.js → timeline-definition-24CTP7MA-DhfUmVud.js} +1 -1
- package/dist/assets/{vennDiagram-4TSXK5OY-D3FmrVNo.js → vennDiagram-4TSXK5OY-ubMqyg9F.js} +1 -1
- package/dist/assets/{wardleyDiagram-VM6X3IG4-JGmd8Ley.js → wardleyDiagram-VM6X3IG4-DGDiyaT7.js} +1 -1
- package/dist/assets/{xychartDiagram-S5SC5T6Z-CVriivaU.js → xychartDiagram-S5SC5T6Z-Cj_dbVk_.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/server.mjs +2 -1
- package/package.json +2 -2
- package/dist/assets/channel-vsnAMebC.js +0 -1
- package/dist/assets/classDiagram-ZZMXUADV-Dql6Ch3d.js +0 -1
- package/dist/assets/classDiagram-v2-VYDZK3BY-Dql6Ch3d.js +0 -1
- package/dist/assets/stateDiagram-v2-MP3YSRHH-BpIwsc6N.js +0 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-CAtySeEC.js +0 -8
package/README.md
CHANGED
|
@@ -24,6 +24,10 @@ polling or another database: the session is the durable record, and `.pi/loops/`
|
|
|
24
24
|
## Commands, providers, and chat models
|
|
25
25
|
|
|
26
26
|
Open **Commands** or press **Cmd/Ctrl K**. Typing `/` in the composer opens the same keyboard-navigable menu.
|
|
27
|
+
Use **↑/↓** to browse and **Enter** to choose. Model/provider forms focus their controls when ready;
|
|
28
|
+
the model filter's arrows enter the model list, and Enter confirms the selected model. Pi choice forms
|
|
29
|
+
also support ↑/↓ (plus Home/End), then Enter/Space to answer. Browsing alone never submits a choice.
|
|
30
|
+
An incoming decision preserves focus if you have started a new, unsubmitted draft.
|
|
27
31
|
Pi discovers that chat's extension commands, prompt templates, and skills; their exact names and source are shown.
|
|
28
32
|
Choosing one inserts it into the composer—review its arguments and explicitly Send. Unknown slash commands are
|
|
29
33
|
rejected without sending them to the model. This is not an emulation of Pi's full terminal interface.
|
|
@@ -191,6 +195,11 @@ The default runner uses Pi 1.4.0's own CLI with a narrow, in-memory compatibilit
|
|
|
191
195
|
before awaiting startup extensions, handle their answers immediately, and hold ordinary commands until setup finishes.
|
|
192
196
|
It verifies the pinned version and exact upstream source before applying the fix; no global Pi files are modified.
|
|
193
197
|
Pi still owns the session, extensions, model configuration, and all decisions.
|
|
198
|
+
|
|
199
|
+
The bundled Loops extension is a fallback: if Pi's enabled, trusted packages already supply
|
|
200
|
+
`@computesdk/pi-loops`, the default runner uses that installation instead of loading a second copy.
|
|
201
|
+
Other extensions remain enabled, and genuine conflicts still fail. This selection is also SHA-pinned
|
|
202
|
+
to Pi 1.4.0's resource loader; explicit `--extensions` or `--pi` retain normal Pi loading semantics.
|
|
194
203
|
Failed answer submissions remain visible with a retryable error; Loops never accepts or declines an integration for you.
|
|
195
204
|
An explicit `--pi` bypasses this compatibility runner, so that executable must support startup dialogs itself.
|
|
196
205
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// The UI supplies Loops only as a fallback. Let Pi's own enabled-resource and
|
|
2
|
+
// trust resolution choose a workspace/user installation before loading code.
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
4
|
+
import { readFileSync, realpathSync } from 'node:fs';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
|
|
7
|
+
const expected = 'ad50235884ea6d5ee14cdae1efcfe6afef58b22b18ce574e81886d57ca9f4642';
|
|
8
|
+
const canonical = (path) => {
|
|
9
|
+
try { return realpathSync(path); } catch { return path; }
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export function filterDefaultLoopsExtension(paths, metadataByPath, fallback, bootstrap = false) {
|
|
13
|
+
const fallbackPath = canonical(fallback);
|
|
14
|
+
// The app's fallback is not a trust provider. Defer it until Pi has made its
|
|
15
|
+
// trust decision, otherwise its factory can run before a project copy wins.
|
|
16
|
+
if (bootstrap) return paths.filter((path) => canonical(path) !== fallbackPath);
|
|
17
|
+
const hasInstalledLoops = paths.some((path) => {
|
|
18
|
+
if (canonical(path) === fallbackPath) return false;
|
|
19
|
+
// Do not infer identity from a filename, tool name, or package source string.
|
|
20
|
+
// Only roots already discovered by Pi as a package are eligible.
|
|
21
|
+
const root = metadataByPath.get(path)?.packageRoot;
|
|
22
|
+
if (!root) return false;
|
|
23
|
+
try {
|
|
24
|
+
return JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')).name === '@computesdk/pi-loops';
|
|
25
|
+
} catch { return false; }
|
|
26
|
+
});
|
|
27
|
+
return hasInstalledLoops ? paths.filter((path) => canonical(path) !== fallbackPath) : paths;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function patchDefaultLoopsExtension(source, fallback) {
|
|
31
|
+
if (createHash('sha256').update(source).digest('hex') !== expected) {
|
|
32
|
+
throw new Error('Unsupported Pi resource loader source; default Loops compatibility patch requires Pi 1.4.0');
|
|
33
|
+
}
|
|
34
|
+
// extensionsOverride runs after extension execution and conflict detection.
|
|
35
|
+
// Filter only our implicit CLI fallback, before either operation, in both the
|
|
36
|
+
// untrusted bootstrap pass and the final trusted/untrusted resource pass.
|
|
37
|
+
const declaration = 'const extensionPaths = (this.noExtensions ? cliEnabledExtensions : this.mergePaths(cliEnabledExtensions, enabledExtensions))';
|
|
38
|
+
const warnings = ' const packageWarnings = collectExtensionPackageWarnings(extensionPaths, metadataByPath);';
|
|
39
|
+
const bootstrapMethod = ' async loadCurrentExtensionSet(options) {';
|
|
40
|
+
if (source.split(declaration).length !== 3 || source.split(warnings).length !== 3 || source.split(bootstrapMethod).length !== 2) {
|
|
41
|
+
throw new Error('Pi default Loops patch anchor mismatch');
|
|
42
|
+
}
|
|
43
|
+
source = source.replaceAll(declaration, declaration.replace('extensionPaths', 'discoveredExtensionPaths'));
|
|
44
|
+
source = source.split(bootstrapMethod).map((part, index) => part.replace(warnings,
|
|
45
|
+
` const extensionPaths = filterDefaultLoopsExtension(discoveredExtensionPaths, metadataByPath, ${JSON.stringify(fallback)}, ${index === 1});\n${warnings}`)).join(bootstrapMethod);
|
|
46
|
+
return `import { filterDefaultLoopsExtension } from ${JSON.stringify(import.meta.url)};\n${source}`;
|
|
47
|
+
}
|
package/bin/pi-rpc.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import { readFileSync, realpathSync } from 'node:fs';
|
|
|
5
5
|
import { dirname, join } from 'node:path';
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
7
7
|
import { patchRpcStartup } from './pi-rpc-startup.mjs';
|
|
8
|
+
import { patchDefaultLoopsExtension } from './pi-default-extension.mjs';
|
|
8
9
|
|
|
9
10
|
const main = fileURLToPath(import.meta.resolve('@earendil-works/pi-coding-agent'));
|
|
10
11
|
const root = dirname(dirname(main));
|
|
@@ -13,14 +14,27 @@ if (pkg.name !== '@earendil-works/pi-coding-agent' || pkg.version !== '1.4.0') {
|
|
|
13
14
|
throw new Error('Pi RPC runner requires @earendil-works/pi-coding-agent 1.4.0');
|
|
14
15
|
}
|
|
15
16
|
const target = realpathSync(join(root, 'dist/modes/rpc/rpc-mode.js'));
|
|
17
|
+
// This private runner flag is supplied only for the app's implicit default.
|
|
18
|
+
// Explicit --extensions and custom Pi executables retain normal CLI semantics.
|
|
19
|
+
const defaultIndex = process.argv.indexOf('--loops-default-extension');
|
|
20
|
+
const fallback = defaultIndex < 0 ? undefined : process.argv[defaultIndex + 1];
|
|
21
|
+
if (defaultIndex >= 0) {
|
|
22
|
+
if (!fallback || fallback.startsWith('-')) throw new Error('--loops-default-extension requires a path');
|
|
23
|
+
process.argv.splice(defaultIndex, 2, '-e', fallback);
|
|
24
|
+
}
|
|
25
|
+
const resourceTarget = fallback ? realpathSync(join(root, 'dist/core/resource-loader.js')) : undefined;
|
|
16
26
|
// Validate before the CLI starts, including when a future CLI stops loading RPC.
|
|
17
27
|
patchRpcStartup(readFileSync(target, 'utf8'));
|
|
28
|
+
if (resourceTarget) patchDefaultLoopsExtension(readFileSync(resourceTarget, 'utf8'), fallback);
|
|
18
29
|
registerHooks({
|
|
19
30
|
load(url, context, nextLoad) {
|
|
20
31
|
const result = nextLoad(url, context);
|
|
21
32
|
if (url.startsWith('file:') && fileURLToPath(url) === target) {
|
|
22
33
|
return { ...result, source: patchRpcStartup(String(result.source)) };
|
|
23
34
|
}
|
|
35
|
+
if (resourceTarget && url.startsWith('file:') && fileURLToPath(url) === resourceTarget) {
|
|
36
|
+
return { ...result, source: patchDefaultLoopsExtension(String(result.source), fallback) };
|
|
37
|
+
}
|
|
24
38
|
return result;
|
|
25
39
|
},
|
|
26
40
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as p,r as u,d as a}from"./chunk-SVP7TREG-
|
|
1
|
+
import{g as p,r as u,d as a}from"./chunk-SVP7TREG-CBg3GrIs.js";import{p as f}from"./chunk-JWPE2WC7-B7DWQYA4.js";import{_ as n,l as o}from"./index-DvyWv1zp.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-C5BZ6yCh.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-
|
|
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-DvyWv1zp.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};
|