@rashidee/co2 1.3.14 → 1.3.16
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/dist/.co2-dat/app.db +0 -0
- package/dist/.co2-dat/app.db-shm +0 -0
- package/dist/.co2-dat/app.db-wal +0 -0
- package/dist/index.js +55 -2
- package/package.json +1 -1
- package/plugin/skills/util-gencicdscript/SKILL.md +43 -0
- package/static/assets/{abnfDiagram-VRR7QNED-D8RafkEP.js → abnfDiagram-VRR7QNED-kjS3baPt.js} +1 -1
- package/static/assets/{arc-Coo8djJL.js → arc-CXd0xnDj.js} +1 -1
- package/static/assets/{architectureDiagram-ZJ3FMSHR-D7fGTL3b.js → architectureDiagram-ZJ3FMSHR-5QfnAz_Q.js} +1 -1
- package/static/assets/{blockDiagram-677ZJIJ3-CjI7s86S.js → blockDiagram-677ZJIJ3-ByICFNDb.js} +1 -1
- package/static/assets/{c4Diagram-LMCZKHZV-Ao3qCcFi.js → c4Diagram-LMCZKHZV-C5a0Ubby.js} +1 -1
- package/static/assets/channel-CrYjYK1f.js +1 -0
- package/static/assets/{chunk-2Q5K7J3B-lUK_s3cG.js → chunk-2Q5K7J3B-UucADWxr.js} +1 -1
- package/static/assets/{chunk-32BRIVSS-PA889NNs.js → chunk-32BRIVSS-WAe17d3N.js} +1 -1
- package/static/assets/{chunk-5VM5RSS4-CxACsgKF.js → chunk-5VM5RSS4-BQBMOb0f.js} +1 -1
- package/static/assets/{chunk-EX3LRPZG-BuSTKl3j.js → chunk-EX3LRPZG-BzaET0n4.js} +1 -1
- package/static/assets/{chunk-JWPE2WC7-CuKFDdbM.js → chunk-JWPE2WC7-D_tBvbZg.js} +1 -1
- package/static/assets/{chunk-MOJQB5TN-CVXUJZuG.js → chunk-MOJQB5TN-CsYb9JBc.js} +1 -1
- package/static/assets/{chunk-RYQCIY6F-DrMs0YPQ.js → chunk-RYQCIY6F-D5xRlnc7.js} +1 -1
- package/static/assets/{chunk-V7JOEXUC-DJopV6W1.js → chunk-V7JOEXUC-y0cEgq6c.js} +1 -1
- package/static/assets/{chunk-VR4S4FIN-CcNBYiui.js → chunk-VR4S4FIN-CSXJHPXT.js} +1 -1
- package/static/assets/{chunk-XXDRQBXY-CCFhxbN4.js → chunk-XXDRQBXY-QFNFGLYZ.js} +1 -1
- package/static/assets/classDiagram-OUVF2IWQ-DoLCCqXD.js +1 -0
- package/static/assets/classDiagram-v2-EOCWNBFH-DoLCCqXD.js +1 -0
- package/static/assets/{cose-bilkent-JH36ORCC-DXoH0ywa.js → cose-bilkent-JH36ORCC-ValIntpZ.js} +1 -1
- package/static/assets/{cynefin-VYW2F7L2-DH8W0rE6.js → cynefin-VYW2F7L2-BgHVKyAR.js} +1 -1
- package/static/assets/{cynefinDiagram-TSTJHNR4-BW_IHnv8.js → cynefinDiagram-TSTJHNR4-LIZzpkLM.js} +1 -1
- package/static/assets/{dagre-VKFMJZFB-Biw6PsWK.js → dagre-VKFMJZFB-DY9b36A5.js} +1 -1
- package/static/assets/{diagram-FQU43EPY-TtNOYp5j.js → diagram-FQU43EPY-aeuYUUxe.js} +1 -1
- package/static/assets/{diagram-G47NLZAW-CQk6Jt_6.js → diagram-G47NLZAW-BWwcYYCF.js} +1 -1
- package/static/assets/{diagram-NH7WQ7WH-DTY1BO9B.js → diagram-NH7WQ7WH-BObFlRPR.js} +1 -1
- package/static/assets/{diagram-OA4YK3LP-DEnO6Eyl.js → diagram-OA4YK3LP-BUnc8m1-.js} +1 -1
- package/static/assets/{diagram-WEI45ONY-WKF4avWj.js → diagram-WEI45ONY-DsNxBIuJ.js} +1 -1
- package/static/assets/{ebnfDiagram-CCIWWBDH-K4uJ1i6v.js → ebnfDiagram-CCIWWBDH-DDL2Id1r.js} +1 -1
- package/static/assets/{erDiagram-Q63AITRT-B4wRa3fY.js → erDiagram-Q63AITRT-DZZcG2QU.js} +1 -1
- package/static/assets/{flowDiagram-23GEKE2U-SnSUCnHl.js → flowDiagram-23GEKE2U-C6GvkBFb.js} +1 -1
- package/static/assets/{ganttDiagram-NO4QXBWP-CsdfAP2-.js → ganttDiagram-NO4QXBWP-C7ydCTnF.js} +1 -1
- package/static/assets/{gitGraphDiagram-IHSO6WYX-C8xab2KC.js → gitGraphDiagram-IHSO6WYX-C60P6bwf.js} +1 -1
- package/static/assets/{index-D74-2ULy.js → index-CfGMfAGO.js} +4 -4
- package/static/assets/{infoDiagram-FWYZ7A6U-CjUSYyJV.js → infoDiagram-FWYZ7A6U-CnH7Q2nX.js} +1 -1
- package/static/assets/{ishikawaDiagram-FXEZZL3T-DGEbhYY4.js → ishikawaDiagram-FXEZZL3T-BNEvOQYX.js} +1 -1
- package/static/assets/{journeyDiagram-5HDEW3XC-Bn8WZeF-.js → journeyDiagram-5HDEW3XC-BOwGZTfX.js} +1 -1
- package/static/assets/{kanban-definition-HUTT4EX6-DD9QNPz9.js → kanban-definition-HUTT4EX6-BEfHVl-l.js} +1 -1
- package/static/assets/{linear-CREoNC-Z.js → linear-BOHPNxBi.js} +1 -1
- package/static/assets/{mindmap-definition-LN4V7U3C-BLCKbp6n.js → mindmap-definition-LN4V7U3C-B84wfT_w.js} +1 -1
- package/static/assets/{pegDiagram-2B236MQR-DLyLfiFi.js → pegDiagram-2B236MQR-BgEa7yRL.js} +1 -1
- package/static/assets/{pieDiagram-ENE6RG2P-B7v1-Mow.js → pieDiagram-ENE6RG2P-DgA9LQlc.js} +1 -1
- package/static/assets/{quadrantDiagram-ABIIQ3AL-Dnt728yI.js → quadrantDiagram-ABIIQ3AL-C5K_r0Mx.js} +1 -1
- package/static/assets/{railroadDiagram-RFXS5EU6-BZ0m-G9m.js → railroadDiagram-RFXS5EU6-Ckh_mLXW.js} +1 -1
- package/static/assets/{requirementDiagram-TGXJPOKE-3SCMjIUR.js → requirementDiagram-TGXJPOKE-CtII7Obm.js} +1 -1
- package/static/assets/{sankeyDiagram-HTMAVEWB-BoK8Wh3S.js → sankeyDiagram-HTMAVEWB-DdkySwbL.js} +1 -1
- package/static/assets/{sequenceDiagram-DBY2YBRQ-B89bqSYK.js → sequenceDiagram-DBY2YBRQ-DEIBg3kY.js} +1 -1
- package/static/assets/{sizeCapture-X5ZJPWSS-BVTk4iE2.js → sizeCapture-X5ZJPWSS-D2MM9f6M.js} +1 -1
- package/static/assets/{stateDiagram-2N3HPSRC-Q5DLz7JU.js → stateDiagram-2N3HPSRC-DHmJsAte.js} +1 -1
- package/static/assets/stateDiagram-v2-6OUMAXLB-B6sumoG6.js +1 -0
- package/static/assets/{swimlanes-5IMT3BWC-1LqBZGZu.js → swimlanes-5IMT3BWC-BBPvUQvZ.js} +2 -2
- package/static/assets/swimlanesDiagram-G3AALYLV-DH2ts1oT.js +8 -0
- package/static/assets/{timeline-definition-FHXFAJF6-Bk8mm9PQ.js → timeline-definition-FHXFAJF6-CG_Q0YTD.js} +1 -1
- package/static/assets/{vennDiagram-L72KCM5P-qS4AIIXn.js → vennDiagram-L72KCM5P-DlFSe4is.js} +1 -1
- package/static/assets/{wardleyDiagram-EHGQE667-BjnQ0zER.js → wardleyDiagram-EHGQE667-BTlvtp2f.js} +1 -1
- package/static/assets/{xychartDiagram-FW5EYKEG-Xtl5bYjl.js → xychartDiagram-FW5EYKEG-Bm14zLxj.js} +1 -1
- package/static/index.html +1 -1
- package/static/assets/channel-Ci11n54j.js +0 -1
- package/static/assets/classDiagram-OUVF2IWQ-D8JGj9_e.js +0 -1
- package/static/assets/classDiagram-v2-EOCWNBFH-D8JGj9_e.js +0 -1
- package/static/assets/stateDiagram-v2-6OUMAXLB-CU_q9WoS.js +0 -1
- package/static/assets/swimlanesDiagram-G3AALYLV-CilhyDV0.js +0 -8
package/dist/.co2-dat/app.db
CHANGED
|
Binary file
|
package/dist/.co2-dat/app.db-shm
CHANGED
|
Binary file
|
package/dist/.co2-dat/app.db-wal
CHANGED
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -6809,7 +6809,7 @@ var {
|
|
|
6809
6809
|
// package.json
|
|
6810
6810
|
var package_default = {
|
|
6811
6811
|
name: "@rashidee/co2",
|
|
6812
|
-
version: "1.3.
|
|
6812
|
+
version: "1.3.16",
|
|
6813
6813
|
description: "Compound Context Studio \u2014 self-hosted team context authoring for CO2 projects",
|
|
6814
6814
|
type: "module",
|
|
6815
6815
|
license: "MIT",
|
|
@@ -22015,6 +22015,46 @@ function stopCicdApp(projectId) {
|
|
|
22015
22015
|
}
|
|
22016
22016
|
|
|
22017
22017
|
// ../server/src/features/cicd/app-proxy.ts
|
|
22018
|
+
var PROXY_BASE_SHIM = `<script data-co2-proxy-base-shim>(function () {
|
|
22019
|
+
var m = location.pathname.match(/^(.*?\\/app-proxy)(?:\\/|$)/)
|
|
22020
|
+
if (!m) return
|
|
22021
|
+
var prefix = m[1]
|
|
22022
|
+
function reroot(p) {
|
|
22023
|
+
return p.charAt(0) === '/' && p.charAt(1) !== '/' && p.indexOf(prefix + '/') !== 0 && p !== prefix ? prefix + p : p
|
|
22024
|
+
}
|
|
22025
|
+
var origFetch = window.fetch.bind(window)
|
|
22026
|
+
window.fetch = function (input, init) {
|
|
22027
|
+
if (typeof input === 'string') input = reroot(input)
|
|
22028
|
+
else if (input instanceof URL && input.host === location.host)
|
|
22029
|
+
input = new URL(reroot(input.pathname) + input.search + input.hash, location.origin)
|
|
22030
|
+
return origFetch(input, init)
|
|
22031
|
+
}
|
|
22032
|
+
var OrigWS = window.WebSocket
|
|
22033
|
+
function PatchedWS(url, protocols) {
|
|
22034
|
+
try {
|
|
22035
|
+
var u = new URL(url, location.href)
|
|
22036
|
+
if (u.host === location.host) {
|
|
22037
|
+
u.pathname = reroot(u.pathname)
|
|
22038
|
+
u.protocol = location.protocol === 'https:' ? 'wss:' : 'ws:'
|
|
22039
|
+
url = u.toString()
|
|
22040
|
+
}
|
|
22041
|
+
} catch (e) { /* malformed URL \u2014 let the real constructor throw */ }
|
|
22042
|
+
return protocols === undefined ? new OrigWS(url) : new OrigWS(url, protocols)
|
|
22043
|
+
}
|
|
22044
|
+
PatchedWS.prototype = OrigWS.prototype
|
|
22045
|
+
PatchedWS.CONNECTING = OrigWS.CONNECTING
|
|
22046
|
+
PatchedWS.OPEN = OrigWS.OPEN
|
|
22047
|
+
PatchedWS.CLOSING = OrigWS.CLOSING
|
|
22048
|
+
PatchedWS.CLOSED = OrigWS.CLOSED
|
|
22049
|
+
window.WebSocket = PatchedWS
|
|
22050
|
+
document.addEventListener('click', function (e) {
|
|
22051
|
+
var t = e.target
|
|
22052
|
+
var a = t && t.closest ? t.closest('a[href]') : null
|
|
22053
|
+
if (!a) return
|
|
22054
|
+
var href = a.getAttribute('href')
|
|
22055
|
+
if (href) a.setAttribute('href', reroot(href))
|
|
22056
|
+
}, true)
|
|
22057
|
+
})()</script>`;
|
|
22018
22058
|
async function proxyCicdAppRequest(db, workspacePath, projectId, prefix, subPath, req) {
|
|
22019
22059
|
const location = resolveCicdApp(db, workspacePath, projectId);
|
|
22020
22060
|
if (!location.present) throw svcError6("CICD_APP_MISSING", 404);
|
|
@@ -22047,6 +22087,13 @@ async function proxyCicdAppRequest(db, workspacePath, projectId, prefix, subPath
|
|
|
22047
22087
|
if (redirectTo?.startsWith("/") && redirectTo !== prefix && !redirectTo.startsWith(`${prefix}/`)) {
|
|
22048
22088
|
responseHeaders.set("location", `${prefix}${redirectTo}`);
|
|
22049
22089
|
}
|
|
22090
|
+
const contentType = upstream.headers.get("content-type") ?? "";
|
|
22091
|
+
if (contentType.includes("text/html")) {
|
|
22092
|
+
const html = await upstream.text();
|
|
22093
|
+
const headTag = html.match(/<head[^>]*>/i);
|
|
22094
|
+
const patched = headTag ? html.replace(headTag[0], `${headTag[0]}${PROXY_BASE_SHIM}`) : `${PROXY_BASE_SHIM}${html}`;
|
|
22095
|
+
return new Response(patched, { status: upstream.status, headers: responseHeaders });
|
|
22096
|
+
}
|
|
22050
22097
|
return new Response(upstream.body, { status: upstream.status, headers: responseHeaders });
|
|
22051
22098
|
}
|
|
22052
22099
|
var CICD_PROXY_UPGRADE_RE = /^\/api\/cicd\/(\d+)\/app-proxy(\/.*)$/;
|
|
@@ -22578,7 +22625,13 @@ function requestPlan(db, workspacePath, projectId, userId) {
|
|
|
22578
22625
|
"utf8"
|
|
22579
22626
|
);
|
|
22580
22627
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
22581
|
-
db.update(cicdSetups).set({
|
|
22628
|
+
db.update(cicdSetups).set({
|
|
22629
|
+
status: "planning",
|
|
22630
|
+
planRequestPath: filePath,
|
|
22631
|
+
planRequestedAt: now,
|
|
22632
|
+
configFingerprint: "",
|
|
22633
|
+
updatedAt: now
|
|
22634
|
+
}).where(eq(cicdSetups.id, setup.id)).run();
|
|
22582
22635
|
createNotification(db, userId, "conductor_progress", "CI/CD deployment plan requested", {
|
|
22583
22636
|
body: filename,
|
|
22584
22637
|
relatedEntityType: "cicd_setup",
|
package/package.json
CHANGED
|
@@ -111,6 +111,49 @@ port, application count) and STOP — the studio starts/embeds the app.
|
|
|
111
111
|
once at boot). Never cache the parsed config in a top-level `const`.
|
|
112
112
|
- The page is bare: no header, sidebar or footer (it is iframed by the studio). Light theme,
|
|
113
113
|
one nav tab per application; the tab body is that application's live log.
|
|
114
|
+
- **Path-prefix proxy awareness (MANDATORY — copy the template below verbatim)**: the studio
|
|
115
|
+
embeds the page through its same-origin reverse proxy at `/api/cicd/<projectId>/app-proxy/` —
|
|
116
|
+
root-absolute client URLs (`fetch('/api/state')`, `href="/infra"`, `ws://host/ws`) escape the
|
|
117
|
+
prefix, hit the studio instead of this app and render an EMPTY BLACK PAGE in the studio.
|
|
118
|
+
Every generated page's client `<script>` MUST begin with this exact bootstrap block:
|
|
119
|
+
|
|
120
|
+
```js
|
|
121
|
+
// Proxy-aware base path — the studio serves this page at /api/cicd/<id>/app-proxy/ (main)
|
|
122
|
+
// and .../app-proxy/infra; direct access serves / and /infra. All client URLs derive from it.
|
|
123
|
+
// Regex-free ON PURPOSE — see the template-literal escaping rule below.
|
|
124
|
+
var _p = location.pathname
|
|
125
|
+
if (_p.endsWith('/infra')) _p = _p.slice(0, -6)
|
|
126
|
+
if (_p.endsWith('/')) _p = _p.slice(0, -1)
|
|
127
|
+
var BASE = _p
|
|
128
|
+
function apiUrl(path) { return BASE + path } // apiUrl('/api/state')
|
|
129
|
+
function wsUrl(path) { // wsUrl('/ws?app=x')
|
|
130
|
+
return (location.protocol === 'https:' ? 'wss://' : 'ws://') + location.host + BASE + path
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
and then NEVER write a root-absolute URL anywhere in client code:
|
|
135
|
+
- every fetch goes through `apiUrl(...)` — `fetch(apiUrl('/api/state'))`, never `fetch('/api/state')`;
|
|
136
|
+
- the log stream socket is `new WebSocket(wsUrl('/ws?app='+encodeURIComponent(name)))` —
|
|
137
|
+
never a hardcoded `ws://` (mixed-content-blocked when the studio is served over HTTPS);
|
|
138
|
+
- the Infrastructure link is set from script (`infralink.href = BASE + '/infra'`), never a
|
|
139
|
+
literal `href="/infra"`.
|
|
140
|
+
Server-side routes stay unprefixed (`/api/state`, `/ws`, `/infra`) — the studio proxy strips
|
|
141
|
+
the prefix before forwarding.
|
|
142
|
+
- **Template-literal escaping in client code (MANDATORY)**: the page HTML/JS is emitted from a
|
|
143
|
+
template literal inside `server.js`, where every backslash is consumed once when the template
|
|
144
|
+
cooks — a client-side regex like `.replace(/\/$/, '')` reaches the browser as
|
|
145
|
+
`.replace(//$/, '')`, the `//` starts a comment, and the WHOLE client script dies with a
|
|
146
|
+
SyntaxError (blank page both direct AND embedded; this exact regression has shipped before).
|
|
147
|
+
Client code inside the template must therefore contain NO backslashes at all: use string
|
|
148
|
+
methods (`endsWith`, `slice`, `split`, `indexOf`) instead of regex literals, and avoid `\n`
|
|
149
|
+
in client strings (concatenate with real newlines or use `String.fromCharCode(10)`).
|
|
150
|
+
- **Syntax self-check gate (MANDATORY before flipping the generation COMPLETED)**:
|
|
151
|
+
1. `node --check server.js` (validates the server code);
|
|
152
|
+
2. start the server briefly, fetch `/` and `/infra`, extract every `<script>…</script>` block
|
|
153
|
+
and run `new Function(script)` on each — any SyntaxError means the page renders blank;
|
|
154
|
+
3. grep the client sections — any remaining `fetch('/`, `href="/`, `'ws://'` or backslash
|
|
155
|
+
inside the page template is a defect; fix via `apiUrl`/`wsUrl`/`BASE` and the escaping
|
|
156
|
+
rule first. Only then flip `CICD_GENERATION.md` to COMPLETED.
|
|
114
157
|
- Infrastructure page: when `infra` is non-empty the main page shows an "Infrastructure" link
|
|
115
158
|
that opens the separate `/infra` page in a new tab — a status-only list of supporting
|
|
116
159
|
3rd-party services, each with a live TCP-reachability dot (polled) and a console link when a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-
|
|
1
|
+
import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-CsYb9JBc.js";import{p as f}from"./chunk-JWPE2WC7-D_tBvbZg.js";import{_ as n,l as o}from"./index-CfGMfAGO.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-BgHVKyAR.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{Y as ln,$ as an,a0 as y,a1 as tn,a2 as F,a3 as q,a4 as _,a5 as un,a6 as rn,a7 as J,a8 as o,a9 as j,aa as sn,ab as on,ac as fn}from"./index-
|
|
1
|
+
import{Y as ln,$ as an,a0 as y,a1 as tn,a2 as F,a3 as q,a4 as _,a5 as un,a6 as rn,a7 as J,a8 as o,a9 as j,aa as sn,ab as on,ac as fn}from"./index-CfGMfAGO.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(fn(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)-an,c=A.apply(this,arguments)-an,B=un(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=_(un(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<rn)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(on((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-rn/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};
|