@graphrefly/graphrefly 0.37.0 → 0.38.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/dist/{chunk-CZIQ6JCE.js → chunk-2YFDSYEF.js} +1 -1
- package/dist/{chunk-YVYSO5CW.js → chunk-4BDQXBXE.js} +1 -1
- package/dist/chunk-5BGFS2XH.js +1 -0
- package/dist/chunk-6773HURD.js +1 -0
- package/dist/{chunk-U3COB5WU.js → chunk-6KZZ6XQE.js} +1 -1
- package/dist/{chunk-5CPPC75H.js → chunk-6VFC334U.js} +1 -1
- package/dist/{chunk-KUVDFOJH.js → chunk-7KZZLWZ6.js} +1 -1
- package/dist/{chunk-Q7EUZ6NN.js → chunk-B5S7KTGP.js} +1 -1
- package/dist/chunk-CMTN3KPT.js +80 -0
- package/dist/chunk-DQJLC6YY.js +1 -0
- package/dist/chunk-DSOVKKTI.js +1 -0
- package/dist/chunk-FAYEMS5M.js +1 -0
- package/dist/chunk-FWGIZP3W.js +1 -0
- package/dist/{chunk-FMI4CWFL.js → chunk-G7JN6LCB.js} +1 -1
- package/dist/{chunk-PCD2MU7X.js → chunk-IBGE62GZ.js} +1 -1
- package/dist/{chunk-MYFR67PY.js → chunk-K5C67OGE.js} +1 -1
- package/dist/chunk-KJEAIIIY.js +43 -0
- package/dist/chunk-LV3ACS5J.js +1 -0
- package/dist/{chunk-LOQRPP4Y.js → chunk-NBGPXQSP.js} +1 -1
- package/dist/chunk-NN3QPJ6U.js +1 -0
- package/dist/{chunk-QWVQIL3T.js → chunk-NSAZ6PR6.js} +1 -1
- package/dist/{chunk-MC5LZG3U.js → chunk-NV63VQHI.js} +1 -1
- package/dist/{chunk-2C4NESZE.js → chunk-O245YLM5.js} +1 -1
- package/dist/{chunk-TLS7M7H4.js → chunk-O2BLVQU4.js} +1 -1
- package/dist/chunk-PHXZRR6C.js +1 -0
- package/dist/{chunk-K6ZFJ473.js → chunk-POCWFIJ7.js} +1 -1
- package/dist/{chunk-C5CBVOCB.js → chunk-QEVSIVSF.js} +1 -1
- package/dist/chunk-QMC2PLNM.js +7 -0
- package/dist/chunk-QOJFR6GS.js +1 -0
- package/dist/{chunk-MQZWA3DF.js → chunk-RZ5HKPGI.js} +1 -1
- package/dist/{chunk-WSLN4JFO.js → chunk-SFK7MN7S.js} +1 -1
- package/dist/{chunk-QP5TH523.js → chunk-SP5O2MIX.js} +1 -1
- package/dist/chunk-TB7JKSVS.js +61 -0
- package/dist/{chunk-T4U24DXX.js → chunk-TMVY7OWG.js} +1 -1
- package/dist/{chunk-UODQF4EY.js → chunk-UAXFKMAG.js} +1 -1
- package/dist/{chunk-TFK4P4CX.js → chunk-UVLZX2OU.js} +1 -1
- package/dist/chunk-XIMFHEKV.js +1 -0
- package/dist/{chunk-XIJKEXWR.js → chunk-XLMYQB6F.js} +1 -1
- package/dist/{chunk-4EATTNAE.js → chunk-XLYF4LBH.js} +1 -1
- package/dist/compat/index.cjs +9 -9
- package/dist/compat/index.d.cts +7 -7
- package/dist/compat/index.d.ts +7 -7
- package/dist/compat/index.js +1 -1
- package/dist/compat/nestjs/index.cjs +11 -11
- package/dist/compat/nestjs/index.d.cts +5 -5
- package/dist/compat/nestjs/index.d.ts +5 -5
- package/dist/compat/nestjs/index.js +1 -1
- package/dist/compat/zustand/index.cjs +7 -7
- package/dist/compat/zustand/index.d.cts +3 -3
- package/dist/compat/zustand/index.d.ts +3 -3
- package/dist/compat/zustand/index.js +1 -1
- package/dist/{composite-_XckYx2e.d.cts → composite-CgG0MqHm.d.cts} +8 -1
- package/dist/{composite-CT_mApQD.d.ts → composite-DTOlDuch.d.ts} +8 -1
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +1 -1
- package/dist/extra/index.cjs +19 -19
- package/dist/extra/index.d.cts +5 -5
- package/dist/extra/index.d.ts +5 -5
- package/dist/extra/index.js +1 -1
- package/dist/extra/node.cjs +2 -2
- package/dist/extra/node.d.cts +107 -1
- package/dist/extra/node.d.ts +107 -1
- package/dist/extra/node.js +2 -2
- package/dist/extra/operators.cjs +1 -1
- package/dist/extra/operators.js +1 -1
- package/dist/extra/reactive.d.cts +1 -1
- package/dist/extra/reactive.d.ts +1 -1
- package/dist/extra/reactive.js +1 -1
- package/dist/extra/sources.cjs +1 -1
- package/dist/extra/sources.js +1 -1
- package/dist/extra/storage-tiers-browser.d.cts +76 -5
- package/dist/extra/storage-tiers-browser.d.ts +76 -5
- package/dist/extra/storage-tiers-node.d.cts +137 -13
- package/dist/extra/storage-tiers-node.d.ts +137 -13
- package/dist/extra/storage-tiers.d.cts +151 -23
- package/dist/extra/storage-tiers.d.ts +151 -23
- package/dist/graph/index.cjs +7 -7
- package/dist/graph/index.d.cts +4 -4
- package/dist/graph/index.d.ts +4 -4
- package/dist/graph/index.js +1 -1
- package/dist/{graph-YQXDndFy.d.ts → graph-BjW1taJl.d.ts} +217 -10
- package/dist/{graph-CaNXUc3c.d.cts → graph-CHsVwf9S.d.cts} +217 -10
- package/dist/{index-CUTHDZ7Q.d.ts → index-5dNRlW7J.d.ts} +3 -3
- package/dist/{index-Bpzw8hx3.d.ts → index-AUqWe_fX.d.ts} +7 -4
- package/dist/{index-fHKHdAso.d.ts → index-B-ORMr3k.d.ts} +2 -2
- package/dist/{index-DcWbx58m.d.cts → index-B2IUcH13.d.cts} +2 -2
- package/dist/{index-DuhOdNyg.d.ts → index-BFaALJxR.d.ts} +2 -2
- package/dist/{index-DPqR3wdW.d.ts → index-BI1wMfyc.d.ts} +2 -2
- package/dist/{index-D0ZxFXYl.d.ts → index-BUFCHvOR.d.ts} +2 -2
- package/dist/{index-CLPQyYY5.d.cts → index-BWUMIt7J.d.cts} +3 -3
- package/dist/{index-CkN8CZlT.d.cts → index-BaSy4L6w.d.cts} +37 -17
- package/dist/{index-B1IcU--K.d.cts → index-BgzPO43H.d.cts} +2 -2
- package/dist/{index-D6tRNEKz.d.cts → index-BhzwpIJc.d.cts} +1 -1
- package/dist/{index-4IwO4mH2.d.cts → index-BkQqf1EF.d.cts} +80 -7
- package/dist/{index-CajEOoAN.d.ts → index-BmWuVdER.d.ts} +2 -2
- package/dist/{index-0qOD-421.d.ts → index-Bn0uZEL4.d.ts} +2 -2
- package/dist/{index-DAKm44My.d.cts → index-BpMZzX9P.d.cts} +2 -2
- package/dist/{index-CrpjECS6.d.cts → index-Bpr0Pwgl.d.cts} +2 -2
- package/dist/{index-BECJ8M0T.d.cts → index-BqcgiSQg.d.cts} +2 -2
- package/dist/{index-DfAo9WKr.d.ts → index-BsZk9T8y.d.ts} +1 -1
- package/dist/{index-CU3z8Cel.d.cts → index-BsgxnHN8.d.cts} +2 -2
- package/dist/index-Bub6x_D4.d.cts +427 -0
- package/dist/{index-C-pFD_FV.d.ts → index-BwOsJfLJ.d.ts} +2 -2
- package/dist/{index-CRycrNfn.d.ts → index-Byp771zP.d.ts} +1 -1
- package/dist/{index-e1m3ZHgc.d.cts → index-C-3UXnHT.d.cts} +1 -1
- package/dist/{index-DTYIRT_v.d.cts → index-C56XZiDe.d.cts} +2 -2
- package/dist/{index-D11pGlaI.d.cts → index-CAV-3RpJ.d.cts} +2 -2
- package/dist/{index-D_DThl_J.d.cts → index-CAbHN_rP.d.cts} +1 -1
- package/dist/{index-BhLA9feT.d.ts → index-CEVzBWeB.d.ts} +2 -2
- package/dist/{index-Ci358GSC.d.cts → index-CM-i58FY.d.cts} +2 -2
- package/dist/{index-B9qJmmv3.d.cts → index-CQsqqEVz.d.cts} +1 -1
- package/dist/{index-C0tga1_x.d.ts → index-CijfwEWx.d.ts} +2 -2
- package/dist/{index-BwtIbzSV.d.cts → index-Ckil6miL.d.cts} +2 -2
- package/dist/{index-BokynmA4.d.cts → index-CpdnP-0y.d.cts} +1 -1
- package/dist/{index-BmLkcDlj.d.ts → index-CrlHFsiT.d.ts} +37 -17
- package/dist/{index-DCAuN9u5.d.cts → index-Czk3r0yA.d.cts} +37 -3
- package/dist/{index-C4N-dg5U.d.cts → index-D-B7U42V.d.cts} +2 -2
- package/dist/{index-CKcnuQ2c.d.ts → index-D-HZ7sP4.d.ts} +2 -2
- package/dist/{index-D6pwWiOc.d.cts → index-D7-RSD93.d.cts} +2 -2
- package/dist/{index-9mbs_PIG.d.ts → index-D9vBTuzo.d.ts} +2 -2
- package/dist/{index-C_qi0WlF.d.cts → index-DJNAWzcH.d.cts} +2 -2
- package/dist/{index-Ae6L8liv.d.ts → index-DJVQ-t07.d.ts} +2 -2
- package/dist/{index-D_d1erkR.d.ts → index-DKrIuF-r.d.ts} +2 -2
- package/dist/{index-DXz9uwcs.d.ts → index-DOU1Ee_k.d.ts} +1 -1
- package/dist/{index-D1E1tqHT.d.ts → index-DTDVDzhA.d.ts} +37 -3
- package/dist/{index-B5UR87KG.d.ts → index-DY2f2b9z.d.ts} +4 -2
- package/dist/{index-D8IyqHvT.d.cts → index-DeSsvHDD.d.cts} +4 -2
- package/dist/index-Di7OdwlO.d.ts +427 -0
- package/dist/{index-CzIWlnPp.d.ts → index-DqICM_I7.d.ts} +80 -7
- package/dist/{index-BOfHwQc1.d.ts → index-ML6vHKXK.d.ts} +1 -1
- package/dist/{index-DqtXA3yX.d.cts → index-UsU9ptzs.d.cts} +7 -4
- package/dist/{index-B46GWgk3.d.ts → index-Vz7KPfgz.d.ts} +1 -1
- package/dist/index.cjs +50 -50
- package/dist/index.d.cts +32 -32
- package/dist/index.d.ts +32 -32
- package/dist/index.js +1 -1
- package/dist/meta-BYqlATmg.d.ts +98 -0
- package/dist/meta-DreaEM_a.d.cts +98 -0
- package/dist/patterns/ai/browser.cjs +2 -2
- package/dist/patterns/ai/browser.js +1 -1
- package/dist/patterns/ai/index.cjs +21 -21
- package/dist/patterns/ai/index.d.cts +9 -9
- package/dist/patterns/ai/index.d.ts +9 -9
- package/dist/patterns/ai/index.js +1 -1
- package/dist/patterns/ai/node.js +1 -1
- package/dist/patterns/audit/index.cjs +7 -7
- package/dist/patterns/audit/index.d.cts +5 -5
- package/dist/patterns/audit/index.d.ts +5 -5
- package/dist/patterns/audit/index.js +1 -1
- package/dist/patterns/cqrs/index.cjs +7 -7
- package/dist/patterns/cqrs/index.d.cts +4 -4
- package/dist/patterns/cqrs/index.d.ts +4 -4
- package/dist/patterns/cqrs/index.js +1 -1
- package/dist/patterns/demo-shell/index.cjs +8 -8
- package/dist/patterns/demo-shell/index.d.cts +4 -4
- package/dist/patterns/demo-shell/index.d.ts +4 -4
- package/dist/patterns/demo-shell/index.js +1 -1
- package/dist/patterns/domain-templates/index.cjs +7 -7
- package/dist/patterns/domain-templates/index.d.cts +3 -3
- package/dist/patterns/domain-templates/index.d.ts +3 -3
- package/dist/patterns/domain-templates/index.js +1 -1
- package/dist/patterns/graphspec/index.cjs +21 -21
- package/dist/patterns/graphspec/index.d.cts +3 -3
- package/dist/patterns/graphspec/index.d.ts +3 -3
- package/dist/patterns/graphspec/index.js +1 -1
- package/dist/patterns/guarded-execution/index.cjs +7 -7
- package/dist/patterns/guarded-execution/index.d.cts +6 -6
- package/dist/patterns/guarded-execution/index.d.ts +6 -6
- package/dist/patterns/guarded-execution/index.js +1 -1
- package/dist/patterns/harness/index.cjs +12 -12
- package/dist/patterns/harness/index.d.cts +8 -8
- package/dist/patterns/harness/index.d.ts +8 -8
- package/dist/patterns/harness/index.js +1 -1
- package/dist/patterns/job-queue/index.cjs +7 -7
- package/dist/patterns/job-queue/index.d.cts +4 -4
- package/dist/patterns/job-queue/index.d.ts +4 -4
- package/dist/patterns/job-queue/index.js +1 -1
- package/dist/patterns/lens/index.cjs +7 -7
- package/dist/patterns/lens/index.d.cts +4 -4
- package/dist/patterns/lens/index.d.ts +4 -4
- package/dist/patterns/lens/index.js +1 -1
- package/dist/patterns/memory/index.cjs +7 -7
- package/dist/patterns/memory/index.d.cts +6 -4
- package/dist/patterns/memory/index.d.ts +6 -4
- package/dist/patterns/memory/index.js +1 -1
- package/dist/patterns/messaging/index.cjs +7 -7
- package/dist/patterns/messaging/index.d.cts +4 -4
- package/dist/patterns/messaging/index.d.ts +4 -4
- package/dist/patterns/messaging/index.js +1 -1
- package/dist/patterns/orchestration/index.cjs +7 -7
- package/dist/patterns/orchestration/index.d.cts +4 -4
- package/dist/patterns/orchestration/index.d.ts +4 -4
- package/dist/patterns/orchestration/index.js +1 -1
- package/dist/patterns/process/index.d.cts +5 -5
- package/dist/patterns/process/index.d.ts +5 -5
- package/dist/patterns/process/index.js +1 -1
- package/dist/patterns/reactive-layout/index.cjs +8 -8
- package/dist/patterns/reactive-layout/index.d.cts +4 -4
- package/dist/patterns/reactive-layout/index.d.ts +4 -4
- package/dist/patterns/reactive-layout/index.js +1 -1
- package/dist/patterns/reduction/index.cjs +7 -7
- package/dist/patterns/reduction/index.d.cts +3 -3
- package/dist/patterns/reduction/index.d.ts +3 -3
- package/dist/patterns/reduction/index.js +1 -1
- package/dist/patterns/refine-loop/index.cjs +8 -8
- package/dist/patterns/refine-loop/index.d.cts +5 -5
- package/dist/patterns/refine-loop/index.d.ts +5 -5
- package/dist/patterns/refine-loop/index.js +1 -1
- package/dist/patterns/resilient-pipeline/index.cjs +1 -1
- package/dist/patterns/resilient-pipeline/index.d.cts +4 -4
- package/dist/patterns/resilient-pipeline/index.d.ts +4 -4
- package/dist/patterns/resilient-pipeline/index.js +1 -1
- package/dist/patterns/surface/index.cjs +14 -14
- package/dist/patterns/surface/index.d.cts +4 -4
- package/dist/patterns/surface/index.d.ts +4 -4
- package/dist/patterns/surface/index.js +1 -1
- package/dist/{pipeline-graph-DX2Twdj-.d.ts → pipeline-graph-9JBbmRxA.d.ts} +2 -2
- package/dist/{pipeline-graph-BrrYGjuZ.d.cts → pipeline-graph-DuHpXSOn.d.cts} +2 -2
- package/dist/{reactive-layout-DrGjuwyC.d.cts → reactive-layout-BMLDB4Vd.d.cts} +1 -1
- package/dist/{reactive-layout-BDdngW56.d.ts → reactive-layout-D-tRiNhg.d.ts} +1 -1
- package/dist/{reactive-log-jirQsxMY.d.ts → reactive-log-BgWSA1fg.d.ts} +28 -1
- package/dist/{reactive-log-ScpWyqny.d.cts → reactive-log-C3IMAGpT.d.cts} +28 -1
- package/dist/resilience-LGBK236C.js +1 -0
- package/dist/{topology-tree-BI665P0L.d.ts → topology-tree-D47-nI6Z.d.ts} +1 -1
- package/dist/{topology-tree-BkhmMg2a.d.cts → topology-tree-jrZue3ao.d.cts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-533RQFF6.js +0 -1
- package/dist/chunk-6SVKZ7VI.js +0 -1
- package/dist/chunk-A5HZZYRK.js +0 -1
- package/dist/chunk-B4L5X2QO.js +0 -7
- package/dist/chunk-FJ6IEMOS.js +0 -1
- package/dist/chunk-G6Q3DUMJ.js +0 -1
- package/dist/chunk-GDDPCDLG.js +0 -1
- package/dist/chunk-GFOT6UBB.js +0 -1
- package/dist/chunk-JJTF75VS.js +0 -1
- package/dist/chunk-K2WYIVHM.js +0 -1
- package/dist/chunk-KTWBUJO5.js +0 -61
- package/dist/chunk-M27MVZCP.js +0 -1
- package/dist/chunk-NKKUUKPD.js +0 -43
- package/dist/chunk-QKBCTKH7.js +0 -1
- package/dist/chunk-WGST56ZH.js +0 -80
- package/dist/index-BCq12BqB.d.ts +0 -139
- package/dist/index-DbWwMWiB.d.cts +0 -139
- package/dist/meta-BGO6C7K9.d.cts +0 -41
- package/dist/meta-CC6EPdpK.d.ts +0 -41
- package/dist/resilience-OBU472D2.js +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { C as CatalogFnEntry, a as CatalogSourceEntry, b as ConfigFieldSchema, F as FnFactory, G as GraphSpec, c as GraphSpecCatalog, d as GraphSpecFeedbackEdge, e as GraphSpecNode, f as GraphSpecTemplate, g as GraphSpecTemplateRef, h as GraphSpecValidation, S as SourceFactory } from '../../index-
|
|
2
|
-
export { C as CreateGraphOptions, R as ReduceOptions, a as RestoreSnapshotOptions, S as SNAPSHOT_WIRE_VERSION, b as SaveSnapshotResult, c as SurfaceError, d as SurfaceErrorCode, e as SurfaceErrorPayload, f as asSurfaceError, g as createGraph, h as deleteSnapshot, i as diffSnapshots, l as listSnapshots, r as restoreSnapshot, j as runReduction, s as saveSnapshot } from '../../index-
|
|
1
|
+
export { C as CatalogFnEntry, a as CatalogSourceEntry, b as ConfigFieldSchema, F as FnFactory, G as GraphSpec, c as GraphSpecCatalog, d as GraphSpecFeedbackEdge, e as GraphSpecNode, f as GraphSpecTemplate, g as GraphSpecTemplateRef, h as GraphSpecValidation, S as SourceFactory } from '../../index-Czk3r0yA.cjs';
|
|
2
|
+
export { C as CreateGraphOptions, R as ReduceOptions, a as RestoreSnapshotOptions, S as SNAPSHOT_WIRE_VERSION, b as SaveSnapshotResult, c as SurfaceError, d as SurfaceErrorCode, e as SurfaceErrorPayload, f as asSurfaceError, g as createGraph, h as deleteSnapshot, i as diffSnapshots, l as listSnapshots, r as restoreSnapshot, j as runReduction, s as saveSnapshot } from '../../index-D-B7U42V.cjs';
|
|
3
3
|
import '../../node-fSc-hCv8.cjs';
|
|
4
|
-
import '../../graph-
|
|
5
|
-
import '../../meta-
|
|
4
|
+
import '../../graph-CHsVwf9S.cjs';
|
|
5
|
+
import '../../meta-DreaEM_a.cjs';
|
|
6
6
|
import '../../extra/storage-core.cjs';
|
|
7
7
|
import '../../extra/storage-tiers.cjs';
|
|
8
8
|
import '../../types-BMSGPlpO.cjs';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { C as CatalogFnEntry, a as CatalogSourceEntry, b as ConfigFieldSchema, F as FnFactory, G as GraphSpec, c as GraphSpecCatalog, d as GraphSpecFeedbackEdge, e as GraphSpecNode, f as GraphSpecTemplate, g as GraphSpecTemplateRef, h as GraphSpecValidation, S as SourceFactory } from '../../index-
|
|
2
|
-
export { C as CreateGraphOptions, R as ReduceOptions, a as RestoreSnapshotOptions, S as SNAPSHOT_WIRE_VERSION, b as SaveSnapshotResult, c as SurfaceError, d as SurfaceErrorCode, e as SurfaceErrorPayload, f as asSurfaceError, g as createGraph, h as deleteSnapshot, i as diffSnapshots, l as listSnapshots, r as restoreSnapshot, j as runReduction, s as saveSnapshot } from '../../index-
|
|
1
|
+
export { C as CatalogFnEntry, a as CatalogSourceEntry, b as ConfigFieldSchema, F as FnFactory, G as GraphSpec, c as GraphSpecCatalog, d as GraphSpecFeedbackEdge, e as GraphSpecNode, f as GraphSpecTemplate, g as GraphSpecTemplateRef, h as GraphSpecValidation, S as SourceFactory } from '../../index-DTDVDzhA.js';
|
|
2
|
+
export { C as CreateGraphOptions, R as ReduceOptions, a as RestoreSnapshotOptions, S as SNAPSHOT_WIRE_VERSION, b as SaveSnapshotResult, c as SurfaceError, d as SurfaceErrorCode, e as SurfaceErrorPayload, f as asSurfaceError, g as createGraph, h as deleteSnapshot, i as diffSnapshots, l as listSnapshots, r as restoreSnapshot, j as runReduction, s as saveSnapshot } from '../../index-CijfwEWx.js';
|
|
3
3
|
import '../../node-fSc-hCv8.js';
|
|
4
|
-
import '../../graph-
|
|
5
|
-
import '../../meta-
|
|
4
|
+
import '../../graph-BjW1taJl.js';
|
|
5
|
+
import '../../meta-BYqlATmg.js';
|
|
6
6
|
import '../../extra/storage-core.js';
|
|
7
7
|
import '../../extra/storage-tiers.js';
|
|
8
8
|
import '../../types-CidcBDuk.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j}from"../../chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j}from"../../chunk-O2BLVQU4.js";import"../../chunk-CMTN3KPT.js";import"../../chunk-XLMYQB6F.js";import"../../chunk-O32GJOUJ.js";import"../../chunk-QMC2PLNM.js";import"../../chunk-SGS4OJGS.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-6773HURD.js";import"../../chunk-4VVTGLXJ.js";import"../../chunk-DQJLC6YY.js";import"../../chunk-TZQPPQEQ.js";import"../../chunk-RZ5HKPGI.js";import"../../chunk-LYCLF26R.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{e as SNAPSHOT_WIRE_VERSION,a as SurfaceError,b as asSurfaceError,c as createGraph,j as deleteSnapshot,h as diffSnapshots,i as listSnapshots,g as restoreSnapshot,d as runReduction,f as saveSnapshot};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as Node, c as NodeActions } from './node-fSc-hCv8.js';
|
|
2
2
|
import { D as DerivedFn } from './sugar-D13E2M_z.js';
|
|
3
|
-
import { R as ReactiveLogBundle } from './reactive-log-
|
|
4
|
-
import { G as Graph, a as GraphOptions } from './graph-
|
|
3
|
+
import { R as ReactiveLogBundle } from './reactive-log-BgWSA1fg.js';
|
|
4
|
+
import { G as Graph, a as GraphOptions } from './graph-BjW1taJl.js';
|
|
5
5
|
import { B as BaseAuditRecord } from './imperative-audit-ahAE65a9.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as Node, c as NodeActions } from './node-fSc-hCv8.cjs';
|
|
2
2
|
import { D as DerivedFn } from './sugar-DgaGJcI6.cjs';
|
|
3
|
-
import { R as ReactiveLogBundle } from './reactive-log-
|
|
4
|
-
import { G as Graph, a as GraphOptions } from './graph-
|
|
3
|
+
import { R as ReactiveLogBundle } from './reactive-log-C3IMAGpT.cjs';
|
|
4
|
+
import { G as Graph, a as GraphOptions } from './graph-CHsVwf9S.cjs';
|
|
5
5
|
import { B as BaseAuditRecord } from './imperative-audit-ahAE65a9.cjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -160,7 +160,34 @@ declare class NativeLogBackend<T> implements LogBackend<T> {
|
|
|
160
160
|
private _rawAppend;
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
|
-
* Creates an append-only reactive log
|
|
163
|
+
* Creates an append-only reactive log that emits immutable `readonly T[]` snapshots.
|
|
164
|
+
*
|
|
165
|
+
* Each structural mutation (`append`, `appendMany`, `clear`, `trimHead`) triggers
|
|
166
|
+
* a two-phase `[DIRTY, DATA]` emission on the `entries` node so downstream
|
|
167
|
+
* derived nodes update reactively. Views (`tail`, `slice`, `fromCursor`) are
|
|
168
|
+
* memoized derived nodes — subscribe once and they stay live.
|
|
169
|
+
*
|
|
170
|
+
* @param initial - Optional initial entries loaded into the log at construction.
|
|
171
|
+
* @param options - Optional name, max size (ring buffer), versioning level, guard policy, and custom backend.
|
|
172
|
+
* @returns `ReactiveLogBundle<T>` with `entries`, `append`, `appendMany`, `clear`, `trimHead`, `view`, `attach`, `attachStorage`, and disposal methods.
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```ts
|
|
176
|
+
* import { reactiveLog } from "@graphrefly/graphrefly/extra";
|
|
177
|
+
*
|
|
178
|
+
* const log = reactiveLog<string>([], { name: "messages" });
|
|
179
|
+
* log.entries.subscribe((msgs) => {
|
|
180
|
+
* for (const m of msgs) {
|
|
181
|
+
* if (m[0] === 1) console.log("entries:", m[1]);
|
|
182
|
+
* }
|
|
183
|
+
* });
|
|
184
|
+
* log.append("hello");
|
|
185
|
+
* log.append("world");
|
|
186
|
+
* ```
|
|
187
|
+
*
|
|
188
|
+
* @remarks
|
|
189
|
+
* **Ring buffer:** Pass `maxSize` to cap the log length; older entries are evicted on overflow.
|
|
190
|
+
* **Storage:** Call `attachStorage(tiers)` to wire one or more `AppendLogStorageTier` instances for persistence.
|
|
164
191
|
*
|
|
165
192
|
* @category extra
|
|
166
193
|
*/
|
|
@@ -160,7 +160,34 @@ declare class NativeLogBackend<T> implements LogBackend<T> {
|
|
|
160
160
|
private _rawAppend;
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
|
-
* Creates an append-only reactive log
|
|
163
|
+
* Creates an append-only reactive log that emits immutable `readonly T[]` snapshots.
|
|
164
|
+
*
|
|
165
|
+
* Each structural mutation (`append`, `appendMany`, `clear`, `trimHead`) triggers
|
|
166
|
+
* a two-phase `[DIRTY, DATA]` emission on the `entries` node so downstream
|
|
167
|
+
* derived nodes update reactively. Views (`tail`, `slice`, `fromCursor`) are
|
|
168
|
+
* memoized derived nodes — subscribe once and they stay live.
|
|
169
|
+
*
|
|
170
|
+
* @param initial - Optional initial entries loaded into the log at construction.
|
|
171
|
+
* @param options - Optional name, max size (ring buffer), versioning level, guard policy, and custom backend.
|
|
172
|
+
* @returns `ReactiveLogBundle<T>` with `entries`, `append`, `appendMany`, `clear`, `trimHead`, `view`, `attach`, `attachStorage`, and disposal methods.
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```ts
|
|
176
|
+
* import { reactiveLog } from "@graphrefly/graphrefly/extra";
|
|
177
|
+
*
|
|
178
|
+
* const log = reactiveLog<string>([], { name: "messages" });
|
|
179
|
+
* log.entries.subscribe((msgs) => {
|
|
180
|
+
* for (const m of msgs) {
|
|
181
|
+
* if (m[0] === 1) console.log("entries:", m[1]);
|
|
182
|
+
* }
|
|
183
|
+
* });
|
|
184
|
+
* log.append("hello");
|
|
185
|
+
* log.append("world");
|
|
186
|
+
* ```
|
|
187
|
+
*
|
|
188
|
+
* @remarks
|
|
189
|
+
* **Ring buffer:** Pass `maxSize` to cap the log length; older entries are evicted on overflow.
|
|
190
|
+
* **Storage:** Call `attachStorage(tiers)` to wire one or more `AppendLogStorageTier` instances for persistence.
|
|
164
191
|
*
|
|
165
192
|
* @category extra
|
|
166
193
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-XIMFHEKV.js";import"./chunk-ESMPEKEV.js";import"./chunk-4VVTGLXJ.js";import"./chunk-DQJLC6YY.js";import"./chunk-RZ5HKPGI.js";import"./chunk-LYCLF26R.js";import"./chunk-CK2E7BTU.js";import"./chunk-QYADASLV.js";export{b as CircuitOpenError,f as RateLimiterOverflowError,i as TimeoutError,c as circuitBreaker,j as fallback,g as rateLimiter,a as retry,k as timeout,e as tokenBucket,d as withBreaker,h as withStatus};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphrefly/graphrefly",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0",
|
|
4
4
|
"packageManager": "pnpm@10.33.0+sha512.10568bb4a6afb58c9eb3630da90cc9516417abebd3fabbe6739f0ae795728da1491e9db5a544c76ad8eb7570f5c4bb3d6c637b2cb41bfdcdb47fa823c8649319",
|
|
5
5
|
"description": "Reactive harness layer for agent workflows. Describe automations in plain language, trace every decision, enforce policies, persist checkpoints. Zero dependencies.",
|
|
6
6
|
"repository": {
|
package/dist/chunk-533RQFF6.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as l,v as o}from"./chunk-LYCLF26R.js";function h(t,e){if(e!=null&&e.length>0)return new Set(e);switch(t){case"standard":return new Set(["type","status","value","deps","meta","v"]);case"full":return null;default:return new Set(["type","deps"])}}function m(t){return t._describeKind!=null?t._describeKind:t._deps.length>0?"derived":t._fn!=null?"producer":"state"}function g(t){let e={};for(let[r,a]of Object.entries(t.meta))try{e[r]=a.cache}catch{}return e}function y(t,e){let r=e==null,a=!r&&e!=null?[...e].filter(n=>n.startsWith("meta.")).map(n=>n.slice(5)):null,d=r||e.has("meta")||a!=null&&a.length>0,c="state",p=[];t instanceof l&&(c=m(t),p=t._deps.map(n=>n.node.name??""));let s={type:c,deps:p};(r||e.has("status"))&&(s.status=t.status);let i=t instanceof l?t._guard:void 0;if(d){let n={...g(t)};if(i!=null&&n.access===void 0&&(n.access=o(i)),a!=null&&a.length>0&&!e.has("meta")){let f={};for(let u of a)u in n&&(f[u]=n[u]);s.meta=f}else s.meta=n}if(t.name!=null&&(s.name=t.name),r||e.has("value")){t.status==="sentinel"&&(s.sentinel=!0);try{s.value=t.cache}catch{}}if((r||e.has("v"))&&t.v!=null){let n={id:t.v.id,version:t.v.version};"cid"in t.v&&(n.cid=t.v.cid,n.prev=t.v.prev),s.v=n}return(r||e.has("guard"))&&i!=null&&(s.guard=o(i)),(r||e.has("lastMutation"))&&t.lastMutation!=null&&(s.lastMutation=t.lastMutation),s}export{h as a,y as b};
|
package/dist/chunk-6SVKZ7VI.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as A,x as v}from"./chunk-JJTF75VS.js";import{b as I}from"./chunk-TZQPPQEQ.js";import{m as p,s as y}from"./chunk-MQZWA3DF.js";import{E as R,G as w,m as h}from"./chunk-LYCLF26R.js";import{b}from"./chunk-CK2E7BTU.js";function z(t){return typeof t=="object"&&t!==null&&"cache"in t&&typeof t.subscribe=="function"}function F(t,a,e){let r=p(t),i=r.v!=null,g=R(e?.initialVerified??null,{...i?{meta:{sourceVersion:null}}:{}}),x=e?.trigger!==void 0&&e.trigger!==null,s=null;if(x&&e?.autoVerify?s=A(p(e.trigger),r):x?s=p(e.trigger):e?.autoVerify&&(s=r),s!==null){let d;if(s===r)d=v(r,c=>a(c));else{let c=r.cache;r.subscribe(f=>{for(let M of f)M[0]===b&&(c=M[1])}),d=v(s,()=>a(c))}y(d,c=>{h(()=>{if(g.down([[b,c]]),i){let f=r.v;f!=null&&g.meta.sourceVersion.down([[b,{id:f.id,version:f.version}]])}})})}return{node:r,verified:g,trigger:s}}function E(t){t.subscribe(()=>{})}function k(t){return t instanceof Map?t:new Map}function B(t,a){if(!Array.isArray(a.upsert))throw new TypeError("distill extraction requires upsert: Array<{ key, value }>");h(()=>{for(let{key:e,value:r}of a.upsert)t.set(e,r);for(let e of a.remove??[])t.delete(e)})}function G(t,a,e){let r=p(t),i=I(e.mapOptions??{}),g=e.budget??2e3,s=e.context!==void 0&&e.context!==null?p(e.context):R(null),d=k(i.entries.cache);i.entries.subscribe(o=>{for(let u of o)u[0]===b&&(d=k(u[1]))});let c=v(r,o=>a(o,d));if(y(c,o=>{B(i,o)}),e.evict){let o=new Map,u=w([i.entries],([l])=>{let m=[],N=k(l);for(let n of o.keys())N.has(n)||(o.get(n)(),o.delete(n));for(let[n,T]of N){let V=e.evict(n,T);if(z(V)){if(!o.has(n)){let S=y(V,D=>{D===!0&&i.has(n)&&i.delete(n)});o.set(n,S)}continue}if(typeof V=="boolean"){V&&m.push(n);continue}throw new TypeError("distill evict() must return boolean or Node<boolean>")}return m});y(u,l=>{for(let m of l)i.delete(m)})}let f=e.consolidateTrigger!==void 0&&e.consolidateTrigger!==null;if(e.consolidate&&f){let o=p(e.consolidateTrigger),u=v(o,()=>e.consolidate(d));y(u,l=>{B(i,l)})}let M=w([i.entries,s],([o,u])=>{let l=[...k(o).entries()].map(([n,T])=>({key:n,value:T,score:e.score(T,u),cost:e.cost(T)}));l.sort((n,T)=>T.score-n.score);let m=[],N=g;for(let n of l)n.cost<=N&&(m.push({key:n.key,value:n.value,score:n.score}),N-=n.cost);return m}),O=w([i.entries],([o])=>k(o).size);return E(M),E(O),{store:i,compact:M,size:O}}export{F as a,G as b};
|
package/dist/chunk-A5HZZYRK.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as E}from"./chunk-ESMPEKEV.js";import{a as g,b as B,i as L}from"./chunk-4VVTGLXJ.js";import{m as I}from"./chunk-MQZWA3DF.js";import{D as _,F as R,m as M,o as S}from"./chunk-LYCLF26R.js";import{b,c as k,d as y,h as C,i as h,j as T}from"./chunk-CK2E7BTU.js";function O(e){return{describeKind:"derived",...e}}function V(e){return e<0?0:e}function F(e){return e[1]}function W(e){if(typeof e!="number"||!Number.isFinite(e))throw new TypeError("backoff strategy must return a finite number");return e<0?0:e}function te(e,i){return typeof e=="function"?j(e,i):U(e,i)}function U(e,i){let r=i?.count,n=i?.backoff,c=r!==void 0?r:n===void 0?0:2147483647;if(c<0)throw new RangeError("retry count must be >= 0");let u=n===void 0?null:typeof n=="string"?L(n):n;return R(t=>{let o=0,l=!1,s=null,f,a=new E;function w(){f?.(),f=void 0}function N(p){if(l)return;if(o>=c){w(),t.down([[T,p]]);return}let m=u===null?0:u(o,p,s);if(m==null){w(),t.down([[T,p]]);return}let d;try{d=W(m)}catch{w(),t.down([[T,p]]);return}s=d,o+=1,w();let x=d>0?d/1e6:1;a.start(x,()=>{l||v()})}function v(){a.cancel(),w(),f=e.subscribe(p=>{if(!l)for(let m of p){let d=m[0];if(d===k)t.down([[k]]);else if(d===b)o=0,s=null,t.emit(m[1]);else if(d===y)t.down([[y]]);else if(d===h)w(),t.down([[h]]);else if(d===T){N(F(m));return}else t.down([m])}})}return v(),()=>{l=!0,a.cancel(),w()}},{...O(),initial:e.cache})}function j(e,i){let r=i?.count,n=i?.backoff,c=r!==void 0?r:n===void 0?0:2147483647;if(c<0)throw new RangeError("retry count must be >= 0");let u=n===void 0?null:typeof n=="string"?L(n):n;return R(t=>{let o=0,l=!1,s=null,f,a=new E;function w(){f?.(),f=void 0}function N(p){if(l)return;if(o>=c){w(),t.down([[T,p]]);return}let m=u===null?0:u(o,p,s);if(m==null){w(),t.down([[T,p]]);return}let d;try{d=W(m)}catch{w(),t.down([[T,p]]);return}s=d,o+=1,w();let x=d>0?d/1e6:1;a.start(x,()=>{l||v()})}function v(){a.cancel(),w();let p;try{p=e()}catch(m){N(m);return}f=p.subscribe(m=>{if(!l)for(let d of m){let x=d[0];if(x===k)t.down([[k]]);else if(x===b)o=0,s=null,t.emit(d[1]);else if(x===y)t.down([[y]]);else if(x===h)w(),t.down([[h]]);else if(x===T){N(F(d));return}else t.down([d])}})}return v(),()=>{l=!0,a.cancel(),w()}},{...O(),initial:i?.initial})}var P=class extends Error{name="CircuitOpenError";constructor(){super("Circuit breaker is open")}};function ne(e){let i=Math.max(1,e?.failureThreshold??5),r=V(e?.cooldownNs??30*1e9),n=e?.cooldown??null,c=Math.max(1,e?.halfOpenMax??1),u=e?.now??S,t="closed",o=0,l=0,s=0,f=r,a=0;function w(){if(!n)return r;let p=n(l);return p!==null?p:r}function N(){t="open",f=w(),s=u(),a=0}return{canExecute(){return t==="closed"?!0:t==="open"?u()-s>=f?(t="half-open",a=1,!0):!1:a<c?(a++,!0):!1},recordSuccess(){t==="half-open"?(t="closed",o=0,l=0):t==="closed"&&(o=0)},recordFailure(p){if(t==="half-open"){l++,N();return}t==="closed"&&(o++,o>=i&&N())},get state(){return t},get failureCount(){return o},reset(){t="closed",o=0,l=0,a=0}}}function re(e,i){let r=i?.onOpen??"skip";return n=>{let c=_([],(u,t)=>{function o(){c.meta.breakerState.down([[b,e.state]])}let l=n.subscribe(s=>{for(let f of s){let a=f[0];a===k?t.down([[k]]):a===b?e.canExecute()?(o(),t.emit(f[1])):(o(),r==="error"?t.down([[T,new P]]):t.down([[y]])):a===y?t.down([[y]]):a===h?(e.recordSuccess(),o(),t.down([[h]])):a===T?(e.recordFailure(F(f)),o(),t.down([f])):t.down([f])}});return o(),l},{...O(),meta:{breakerState:e.state},completeWhenDepsComplete:!1,initial:n.cache});return{node:c,breakerState:c.meta.breakerState}}}function K(e,i){if(e<=0)throw new RangeError("capacity must be > 0");if(i<0)throw new RangeError("refillPerSecond must be >= 0");let r=e,n=S();function c(u){if(i>0){let t=u-n;r=Math.min(e,r+t/1e9*i)}n=u}return{available(){return c(S()),r},tryConsume(u=1){if(u<=0)return!0;let t=S();return c(t),r>=u?(r-=u,!0):!1},putBack(u=1){u<=0||(c(S()),r=Math.min(e,r+u))}}}var A=class extends Error{name="RateLimiterOverflowError";constructor(i){super(`rateLimiter buffer overflow (maxBuffer=${i})`)}};function oe(e,i){let{maxEvents:r,windowNs:n}=i;if(r<=0)throw new RangeError("maxEvents must be > 0");if(n<=0)throw new RangeError("windowNs must be > 0");let c=i.maxBuffer;if(c!==void 0&&c<1)throw new RangeError("maxBuffer must be >= 1");let u=i.onOverflow??"drop-newest",t=r*1e9/n;return R(o=>{let l=K(r,t),s=[],f=new E,a=!1,w=1e9/t;function N(){for(;s.length>0;)if(l.tryConsume(1))o.emit(s.shift());else{f.start(Math.max(1,w/1e6),N);return}}let v=e.subscribe(p=>{for(let m of p){if(a)return;let d=m[0];if(d===k)o.down([[k]]);else if(d===b){if(c!==void 0&&s.length>=c){if(u!=="drop-newest")if(u==="drop-oldest")s.shift(),s.push(m[1]);else{a=!0,f.cancel(),s.length=0,o.down([[T,new A(c)]]);return}}else s.push(m[1]);N()}else if(d===y)o.down([[y]]);else if(d===h)a=!0,f.cancel(),s.length=0,o.down([[h]]);else if(d===T)a=!0,f.cancel(),s.length=0,o.down([m]);else if(d===C){a=!0,f.cancel(),s.length=0,o.down([m]);return}else o.down([m])}});return()=>{a=!0,f.cancel(),v()}},{...O(),initial:e.cache})}function ie(e,i){let r=i?.initialStatus??"pending",n=_([],(c,u)=>{let t=r;return n.meta.status.down([[b,r]]),n.meta.error.down([[b,null]]),e.subscribe(l=>{for(let s of l){let f=s[0];if(f===k)u.down([[k]]);else if(f===b)t==="errored"?M(()=>{n.meta.error.down([[b,null]]),n.meta.status.down([[b,"active"]])}):n.meta.status.down([[b,"active"]]),t="active",u.emit(s[1]);else if(f===y)u.down([[y]]);else if(f===h)n.meta.status.down([[b,"completed"]]),t="completed",u.down([[h]]);else if(f===T){let a=F(s);M(()=>{n.meta.error.down([[b,a]]),n.meta.status.down([[b,"errored"]])}),t="errored",u.down([s])}else u.down([s])}})},{...O(),meta:{status:r,error:null},completeWhenDepsComplete:!1,resubscribable:!0,initial:e.cache});return{node:n,status:n.meta.status,error:n.meta.error}}var D=class extends Error{name="TimeoutError";constructor(i){super(`Timed out after ${i/1e6}ms`)}};function $(e){return e!=null&&typeof e=="object"&&"cache"in e&&typeof e.subscribe=="function"}function Y(e){return e!=null&&typeof e.then=="function"}function q(e){return e!=null&&typeof e=="object"&&typeof e[Symbol.asyncIterator]=="function"}function se(e,i){return R(r=>{let n,c;function u(){c?.(),c=void 0,$(i)||Y(i)||q(i)?n=I(i).subscribe(o=>{r.down(o)}):(r.emit(i),r.down([[h]]))}return c=e.subscribe(t=>{for(let o of t){let l=o[0];if(l===k)r.down([[k]]);else if(l===b)r.emit(o[1]);else if(l===y)r.down([[y]]);else if(l===h)r.down([[h]]);else if(l===T){u();return}else if(l===C){n?.(),r.down([o]);return}else r.down([o])}}),()=>{c?.(),n?.()}},{...O(),initial:e.cache})}function ue(e,i){if(i<=0)throw new RangeError("timeoutNs must be > 0");return R(r=>{let n=!1,c=new E;function u(){let o=i/1e6;c.start(o,()=>{n||(n=!0,t(),r.down([[T,new D(i)]]))})}let t=e.subscribe(o=>{for(let l of o){if(n)return;let s=l[0];if(s===k)r.down([[k]]);else if(s===b)u(),r.emit(l[1]);else if(s===y)r.down([[y]]);else if(s===h){c.cancel(),n=!0,r.down([[h]]);return}else if(s===T){c.cancel(),n=!0,r.down([l]);return}else if(s===C){c.cancel(),n=!0,r.down([l]);return}else r.down([l])}});return u(),()=>{n=!0,c.cancel(),t()}},{...O(),initial:e.cache})}export{te as a,P as b,ne as c,re as d,K as e,A as f,oe as g,ie as h,D as i,se as j,ue as k};
|
package/dist/chunk-B4L5X2QO.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{a as Se}from"./chunk-SGS4OJGS.js";import{a as Le}from"./chunk-ESMPEKEV.js";import{a as re,b as _e}from"./chunk-533RQFF6.js";import{C as Ee}from"./chunk-MQZWA3DF.js";import{A as we,C as L,E as ne,F as Me,G as Oe,e as $e,f as Ne,i as Z,k as Te,l as xe,m as Ae,o as K,p as Pe,s as W}from"./chunk-LYCLF26R.js";import{b as Y,c as me,d as be,e as te,f as ye,g as ve,h as z,i as X,j as Q}from"./chunk-CK2E7BTU.js";function Ie(e,t,r,n={}){let s=t in e.nodes,o=r in e.nodes;if(!s)return oe(t,r,"no-such-from");if(!o)return oe(t,r,"no-such-to");let i=n.maxDepth;if(i!=null&&(!Number.isInteger(i)||i<0))throw new Error("explainPath: maxDepth must be an integer >= 0");if(t===r){if(n.findCycle===!0){let u=ct(e,t,n);if(u!=null)return u}let l=se(t,e.nodes[t],0,n);return ie(t,r,[l])}if(i===0)return oe(t,r,"no-path");let a=je(e,t,r,i);return a.found?ie(t,r,Be(e,a.pathOrder,n)):oe(t,r,a.truncated?"max-depth-exceeded":"no-path")}function je(e,t,r,n){let s=new Map,o=[{path:r,depth:0}],i=new Set([r]),a=0,l=!1;for(;a<o.length;){let h=o[a++];if(h.path===t)break;if(n!=null&&h.depth>=n){let g=e.nodes[h.path];g?.deps&&g.deps.length>0&&(l=!0);continue}let p=e.nodes[h.path];if(p==null)continue;let f=p.deps??[],c=new Map;for(let g=0;g<f.length;g++){let O=f[g];if(!O)continue;let S=c.get(O);S==null&&(S=[],c.set(O,S)),S.push(g)}for(let[g,O]of c)i.has(g)||(i.add(g),s.set(g,{from:h.path,depIndices:O}),o.push({path:g,depth:h.depth+1}))}if(!s.has(t))return{found:!1,pathOrder:[],truncated:l};let u=[{path:t}],d=t;for(;d!==r;){let h=s.get(d);if(h==null)return{found:!1,pathOrder:[],truncated:!1};u[u.length-1].depIndices=h.depIndices,u.push({path:h.from}),d=h.from}return{found:!0,pathOrder:u,truncated:!1}}function ct(e,t,r){let n=e.nodes[t];if(n==null)return null;let s=n.deps??[],o=[];for(let a=0;a<s.length;a++)s[a]===t&&o.push(a);if(o.length>0){let a=se(t,n,0,r);a.dep_index=o[0];let l=se(t,n,1,r);return ie(t,t,[a,l])}let i=null;for(let a=0;a<s.length;a++){let l=s[a];if(!l||l===t)continue;let u=je(e,l,t,r.maxDepth);u.found&&(i==null||u.pathOrder.length<i.pathOrder.length)&&(i=u,i={found:!0,pathOrder:[{path:t,depIndices:[a]},...u.pathOrder],truncated:!1})}return i==null?null:ie(t,t,Be(e,i.pathOrder,r))}function Be(e,t,r){return t.map((n,s)=>{let o=e.nodes[n.path],i=se(n.path,o,s,r);return n.depIndices!=null&&n.depIndices.length>0&&(i.dep_index=n.depIndices[0],n.depIndices.length>1&&(i.dep_indices=[...n.depIndices])),i})}function se(e,t,r,n){let s={path:e,type:t.type,hop:r};t.status!==void 0&&(s.status=t.status),"value"in t&&(s.value=t.value),t.v!=null&&(s.v=t.v);let o=n.annotations?.get(e)??t.annotation;o!=null&&(s.annotation=o);let i=n.lastMutations?.get(e)??t.lastMutation;return i!=null&&(s.lastMutation=i),s}function ie(e,t,r){return Fe(e,t,!0,"ok",r)}function oe(e,t,r){return Fe(e,t,!1,r,[])}function Fe(e,t,r,n,s){let o=dt(e,t,r,n,s);return{from:e,to:t,found:r,reason:n,steps:s,text:o,toJSON(){return{from:e,to:t,found:r,reason:n,steps:s}}}}function dt(e,t,r,n,s){if(!r)switch(n){case"no-such-from":return`explainPath: no node named "${e}"`;case"no-such-to":return`explainPath: no node named "${t}"`;case"max-depth-exceeded":return`explainPath: no path from "${e}" to "${t}" within maxDepth`;default:return`explainPath: no path from "${e}" to "${t}"`}let o=[`Causal path: ${e} \u2192 ${t} (${s.length} step(s))`];for(let i of s){let l=` ${i.hop===0?"\xB7":"\u2193"} ${i.path} (${i.type}${i.status?`/${i.status}`:""})`;if(o.push(l),"value"in i&&o.push(` value: ${ft(i.value)}`),i.annotation!=null&&o.push(` annotation: ${i.annotation}`),i.lastMutation!=null){let u=i.lastMutation.actor;o.push(` actor: ${u.type}${u.id?`:${u.id}`:""}`)}}return o.join(`
|
|
2
|
-
`)}function ft(e){if(e===void 0)return"<sentinel>";if(e===null)return"null";if(typeof e=="string")return JSON.stringify(e);if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return String(e);try{let t=JSON.stringify(e);return t.length>80?`${t.slice(0,77)}...`:t}catch{return String(e)}}var A={object:56,array:64,string:40,number:8,boolean:4,null:0,undefined:0,symbol:40,bigint:16,function:120,map:72,set:72,mapEntry:40,setEntry:24,date:24,regexp:48,error:64,url:80,promise:48,weakmap:40,weakset:40},pt=Symbol.for("sizeof");function He(e){let t=new WeakSet,r=new WeakSet,n=[e],s=0;for(;n.length>0;){let o=n.pop();s+=ht(o,t,r,n)}return s}function ht(e,t,r,n){if(e==null)return 0;switch(typeof e){case"number":return A.number;case"boolean":return A.boolean;case"string":return A.string+e.length*2;case"bigint":return A.bigint+gt(e);case"symbol":return A.symbol;case"function":return t.has(e)?0:(t.add(e),A.function);case"undefined":return 0}let o=e;if(t.has(o))return 0;t.add(o);let i=o[pt];if(typeof i=="function")try{let u=i.call(o);if(typeof u=="number"&&Number.isFinite(u))return u}catch{}if(o instanceof Date)return A.date;if(o instanceof RegExp)return A.regexp+o.source.length*2;if(o instanceof Error){let u=o.message?o.message.length*2:0,d=o.stack?o.stack.length*2:0;return A.error+u+d}if(typeof URL<"u"&&o instanceof URL)return A.url+o.href.length*2;if(typeof Promise<"u"&&o instanceof Promise)return A.promise;if(o instanceof WeakMap)return A.weakmap;if(o instanceof WeakSet)return A.weakset;if(o instanceof Map){let u=A.map;for(let[d,h]of o)u+=A.mapEntry,n.push(d),n.push(h);return u}if(o instanceof Set){let u=A.set;for(let d of o)u+=A.setEntry,n.push(d);return u}if(Array.isArray(o)){let u=A.array+o.length*8;for(let d of o)n.push(d);return u}if(o instanceof ArrayBuffer)return r.has(o)?0:(r.add(o),o.byteLength);if(ArrayBuffer.isView(o)){let u=o;return r.has(u.buffer)?48:(r.add(u.buffer),u.buffer.byteLength+48)}let a=A.object,l=Object.keys(o);for(let u of l){a+=A.string+u.length*2;try{n.push(o[u])}catch{}}return a}function gt(e){let t=e<0n?-e:e;if(t===0n)return 0;let r=t.toString(2).length;return Math.ceil(r/32)*8}function Ve(e,t){let r=t?.topN??10,n=e.describe({detail:"standard"}),s=[],o=e._collectObserveTargets;typeof o=="function"&&o.call(e,"",s);let i=new Map;for(let[p,f]of s)i.set(p,f);let a=[];for(let[p,f]of Object.entries(n.nodes)){let c=i.get(p),g=c instanceof L?c:null,O=g?He(g.cache):0,S=g?g._sinkCount:0,b=f.deps?.length??0,m=f.type==="effect"&&S===0,y=S===0?f.type==="effect"?"orphan-effect":f.type==="derived"?"idle-derived":f.type==="producer"?"idle-producer":null:null;a.push({path:p,type:f.type,status:f.status??"unknown",valueSizeBytes:O,subscriberCount:S,depCount:b,isOrphanEffect:m,orphanKind:y})}let l=a.reduce((p,f)=>p+f.valueSizeBytes,0),u=(p,f)=>[...a].sort(f??((c,g)=>g[p]-c[p])).slice(0,r),d=a.filter(p=>p.orphanKind!=null),h=a.filter(p=>p.isOrphanEffect);return{nodeCount:a.length,edgeCount:n.edges.length,subgraphCount:n.subgraphs.length,nodes:a,totalValueSizeBytes:l,hotspots:{byValueSize:u("valueSizeBytes"),bySubscriberCount:u("subscriberCount"),byDepCount:u("depCount")},orphans:d,orphanEffects:h}}function Re(e){return e>=768&&e<=879||e>=1155&&e<=1161||e>=1425&&e<=1469||e>=1552&&e<=1562||e>=1611&&e<=1631||e>=1648&&e===1648||e>=1750&&e<=1756||e>=1759&&e<=1764||e>=1767&&e<=1768||e>=1770&&e<=1773||e>=1840&&e<=1866||e>=1958&&e<=1968||e>=2304&&e<=2307||e>=2362&&e<=2383||e>=2385&&e<=2391||e>=2402&&e<=2403||e>=2433&&e<=2435||e>=2492&&e<=2509||e>=2561&&e<=2563||e>=2620&&e<=2641||e>=2672&&e<=2673||e>=2677&&e===2677||e>=3633&&e===3633||e>=3636&&e<=3642||e>=3655&&e<=3662||e>=3761&&e===3761||e>=3764&&e<=3772||e>=3784&&e<=3790||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65024&&e<=65039||e>=65056&&e<=65071||e===8205?0:e>=4352&&e<=4447||e>=8986&&e<=8987||e>=9001&&e<=9002||e>=9193&&e<=9203||e>=9208&&e<=9210||e>=9725&&e<=9726||e>=9748&&e<=9749||e>=9800&&e<=9811||e===9855||e===9875||e===9889||e>=9898&&e<=9899||e>=9917&&e<=9918||e>=9924&&e<=9925||e===9934||e===9940||e===9962||e>=9970&&e<=9971||e===9973||e===9978||e===9981||e===9986||e===9989||e>=9992&&e<=9997||e===9999||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e>=10548&&e<=10549||e>=11013&&e<=11015||e>=11035&&e<=11036||e===11088||e===11093||e>=11904&&e<=12350||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12784&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=19968&&e<=40959||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65131||e>=65281&&e<=65376||e>=65504&&e<=65510||e>=126980&&e===126980||e===127183||e>=127344&&e<=127345||e===127358||e===127359||e===127374||e>=127377&&e<=127386||e>=127456&&e<=127487||e>=127488&&e<=127490||e===127514||e===127535||e>=127538&&e<=127546||e>=127568&&e<=127569||e>=127744&&e<=129535||e>=129536&&e<=129791||e>=129792&&e<=130047||e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}function ae(e){let t=0;for(let r of e)t+=Re(r.codePointAt(0));return t}function ze(e,t){if(t<=0)return"";let r=0,n="";for(let s of e){let o=Re(s.codePointAt(0));if(r+o>t){if(t<=1)return"\u2026";for(;r+1>t&&n.length>0;){let i=[...n].pop();n=n.slice(0,-i.length),r-=Re(i.codePointAt(0))}return`${n}\u2026`}n+=s,r+=o}return n}var mt={horizontal:"\u2500",vertical:"\u2502",cornerTL:"\u250C",cornerTR:"\u2510",cornerBL:"\u2514",cornerBR:"\u2518",tDown:"\u252C",tUp:"\u2534",tRight:"\u251C",tLeft:"\u2524",cross:"\u253C",arrowRight:"\u25B6",arrowDown:"\u25BC",arrowLeft:"\u25C0",arrowUp:"\u25B2",boxTL:"\u250C",boxTR:"\u2510",boxBL:"\u2514",boxBR:"\u2518",boxH:"\u2500",boxV:"\u2502"},bt={horizontal:"-",vertical:"|",cornerTL:"+",cornerTR:"+",cornerBL:"+",cornerBR:"+",tDown:"+",tUp:"+",tRight:"+",tLeft:"+",cross:"+",arrowRight:">",arrowDown:"v",arrowLeft:"<",arrowUp:"^",boxTL:"+",boxTR:"+",boxBL:"+",boxBR:"+",boxH:"-",boxV:"|"};function Ue(e,t){let r=t.charset==="ascii"?bt:mt,n=e.width,s=e.height,o=Array.from({length:s},()=>Array.from({length:n},()=>" ")),i=Array.from({length:s},()=>Array.from({length:n},()=>"empty"));for(let a of e.edges)vt(o,i,r,a);for(let a of e.boxes)yt(o,i,r,a,t.labelOf(a.id));return o.map(a=>Et(a.join(""))).join(`
|
|
3
|
-
`)}function yt(e,t,r,n,s){let{x:o,y:i,w:a,h:l}=n;if(a<2||l<2){l>0&&Ke(e,t,o,i,a,s);return}V(e,t,o,i,r.boxTL);for(let d=o+1;d<o+a-1;d+=1)V(e,t,d,i,r.boxH);V(e,t,o+a-1,i,r.boxTR);for(let d=i+1;d<i+l-1;d+=1){V(e,t,o,d,r.boxV);for(let h=o+1;h<o+a-1;h+=1)Je(e,t,h,d," ","empty");V(e,t,o+a-1,d,r.boxV)}V(e,t,o,i+l-1,r.boxBL);for(let d=o+1;d<o+a-1;d+=1)V(e,t,d,i+l-1,r.boxH);V(e,t,o+a-1,i+l-1,r.boxBR);let u=i+Math.floor(l/2);Ke(e,t,o+1,u,a-2,s)}function V(e,t,r,n,s){Je(e,t,r,n,s,s===" "?"empty":s==="\u2500"||s==="-"?"boxH":s==="\u2502"||s==="|"?"boxV":"boxCorner")}function Je(e,t,r,n,s,o){if(n<0||n>=e.length)return;let i=e[n];r<0||r>=i.length||(i[r]=s,t[n][r]=o)}function Ke(e,t,r,n,s,o){if(n<0||n>=e.length)return;let i=r,a=s;for(let l of o){let u=ae(l);if(u!==0){if(a<u)break;i>=0&&i<e[n].length&&(e[n][i]=l,t[n][i]="label",u===2&&i+1<e[n].length&&(e[n][i+1]="",t[n][i+1]="label")),i+=u,a-=u}}for(;a>0;)i>=0&&i<e[n].length&&(e[n][i]=" ",t[n][i]="empty"),i+=1,a-=1}function vt(e,t,r,n){let s=n.points;if(s.length<2)return;for(let l=0;l+1<s.length;l+=1)xt(e,t,r,s[l],s[l+1]);for(let l=1;l+1<s.length;l+=1){let u=s[l-1],d=s[l],h=s[l+1],p=wt(u,d,h,r);p&&qe(e,t,d.x,d.y,p,"edgeCorner")}let o=s[s.length-1],i=s[s.length-2],a=Ot(i,o,r);a&&qe(e,t,o.x,o.y,a,"arrow")}function xt(e,t,r,n,s){if(!(n.x===s.x&&n.y===s.y)){if(n.y===s.y){let o=n.y,i=Math.min(n.x,s.x),a=Math.max(n.x,s.x);for(let l=i;l<=a;l+=1)We(e,t,l,o,r,"h")}else if(n.x===s.x){let o=n.x,i=Math.min(n.y,s.y),a=Math.max(n.y,s.y);for(let l=i;l<=a;l+=1)We(e,t,o,l,r,"v")}}}function We(e,t,r,n,s,o){if(n<0||n>=e.length)return;let i=e[n];if(r<0||r>=i.length)return;let a=t[n][r];if(!(a==="boxH"||a==="boxV"||a==="boxCorner"||a==="label")){if(a==="empty"){i[r]=o==="h"?s.horizontal:s.vertical,t[n][r]=o==="h"?"edgeH":"edgeV";return}if(a==="edgeH"&&o==="v"){i[r]=s.cross,t[n][r]="edgeCorner";return}if(a==="edgeV"&&o==="h"){i[r]=s.cross,t[n][r]="edgeCorner";return}}}function qe(e,t,r,n,s,o){if(n<0||n>=e.length)return;let i=e[n];if(r<0||r>=i.length)return;let a=t[n][r];a==="boxH"||a==="boxV"||a==="boxCorner"||a==="label"||(i[r]=s,t[n][r]=o)}function wt(e,t,r,n){let s=e.y===t.y,o=t.y===r.y;if(s===o)return;if(s){let l=e.x<t.x,u=r.y>t.y;return l&&u?n.cornerTR:l&&!u?n.cornerBR:!l&&u?n.cornerTL:n.cornerBL}let i=e.y<t.y,a=r.x>t.x;return i&&a?n.cornerBL:i&&!a?n.cornerBR:!i&&a?n.cornerTL:n.cornerTR}function Ot(e,t,r){if(t.x>e.x)return r.arrowRight;if(t.x<e.x)return r.arrowLeft;if(t.y>e.y)return r.arrowDown;if(t.y<e.y)return r.arrowUp}function Et(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===32;)t-=1;return e.slice(0,t)}function Qe(e){let t=_t(e);St(t),Rt(t),Gt(t),Dt(t,e);let r=$t(t,e),{width:n,height:s}=Tt(t),o=[];for(let i of t.layers)for(let a of i)a.isVirtual||o.push({id:a.id,layer:a.layer,order:a.order,x:a.x,y:a.y,w:a.w,h:a.h});return{boxes:o,edges:r,width:n,height:s}}function _t(e){let t=new Map;for(let s of e.nodes)t.set(s,{id:s,isVirtual:!1,layer:-1,order:0,x:0,y:0,w:e.widthCells(s),h:e.heightCells(s),in:[],out:[]});let r=[],n=0;for(let s of e.edges){if(s.from===s.to)continue;let o=t.get(s.from),i=t.get(s.to);if(!o||!i)continue;let a={chainId:n++,chainFrom:s.from,chainTo:s.to,fromId:s.from,toId:s.to,hopIndex:0,chainLen:1};o.out.push(a),i.in.push(a),r.push(a)}return{nodes:t,layers:[],hops:r}}function St(e){let t=new Map;for(let o of e.nodes.values())t.set(o.id,o.in.length);let r=[];for(let o of e.nodes.values())(t.get(o.id)??0)===0&&(o.layer=0,r.push(o));let n=new Set,s=0;for(;s<r.length;){let o=r[s++];if(!n.has(o.id)){n.add(o.id);for(let i of o.out){let a=e.nodes.get(i.toId);a.layer=Math.max(a.layer,o.layer+1);let l=(t.get(a.id)??0)-1;t.set(a.id,l),l<=0&&r.push(a)}}}for(let o of e.nodes.values())o.layer<0&&(o.layer=0)}function Rt(e){let t=Math.max(0,...Array.from(e.nodes.values(),o=>o.layer)),r=Array.from({length:t+1},()=>[]);for(let o of e.nodes.values())r[o.layer].push(o);let n=[],s=0;for(let o of e.hops){let i=e.nodes.get(o.fromId),a=e.nodes.get(o.toId),l=a.layer-i.layer;if(l<=0){i.out=i.out.filter(h=>h!==o),a.in=a.in.filter(h=>h!==o);continue}if(l===1){o.hopIndex=0,o.chainLen=1,n.push(o);continue}i.out=i.out.filter(h=>h!==o),a.in=a.in.filter(h=>h!==o);let u=i;for(let h=1;h<l;h+=1){let p=`__virt_${s++}__`,f={id:p,isVirtual:!0,layer:i.layer+h,order:0,x:0,y:0,w:0,h:1,in:[],out:[]};e.nodes.set(p,f),r[f.layer].push(f);let c={chainId:o.chainId,chainFrom:o.chainFrom,chainTo:o.chainTo,fromId:u.id,toId:p,hopIndex:h-1,chainLen:l};u.out.push(c),f.in.push(c),n.push(c),u=f}let d={chainId:o.chainId,chainFrom:o.chainFrom,chainTo:o.chainTo,fromId:u.id,toId:a.id,hopIndex:l-1,chainLen:l};u.out.push(d),a.in.push(d),n.push(d)}for(let o of r)for(let i=0;i<o.length;i+=1)o[i].order=i;e.layers=r,e.hops=n}function Gt(e){for(let r=0;r<4;r+=1){for(let n=1;n<e.layers.length;n+=1)Ye(e,e.layers[n],"in"),ue(e.layers[n]);for(let n=e.layers.length-2;n>=0;n-=1)Ye(e,e.layers[n],"out"),ue(e.layers[n])}for(let r=0;r<2;r+=1){let n=!1;for(let s=1;s<e.layers.length;s+=1){let o=e.layers[s];for(let i=0;i+1<o.length;i+=1){let a=Xe(e,o[i],o[i+1],"in");[o[i],o[i+1]]=[o[i+1],o[i]],ue(o),Xe(e,o[i],o[i+1],"in")<a?n=!0:([o[i],o[i+1]]=[o[i+1],o[i]],ue(o))}}if(!n)break}}function Ye(e,t,r){let n=new Map;for(let s of t){let o=r==="in"?s.in:s.out;if(o.length===0){n.set(s.id,s.order);continue}let i=0,a=0;for(let l of o){let u=e.nodes.get(r==="in"?l.fromId:l.toId);u&&(i+=u.order,a+=1)}n.set(s.id,a===0?s.order:i/a)}t.sort((s,o)=>{let i=n.get(s.id),a=n.get(o.id);return i!==a?i-a:s.order-o.order})}function ue(e){for(let t=0;t<e.length;t+=1)e[t].order=t}function Xe(e,t,r,n){let s=n==="in"?t.in:t.out,o=n==="in"?r.in:r.out,i=0;for(let a of s)for(let l of o){let u=e.nodes.get(n==="in"?a.fromId:a.toId)?.order??0,d=e.nodes.get(n==="in"?l.fromId:l.toId)?.order??0;(t.order<r.order&&u>d||t.order>r.order&&u<d)&&(i+=1)}return i}function Dt(e,t){t.direction==="LR"?Ct(e,t):kt(e,t)}function Ct(e,t){let r=[],n=0;for(let s=0;s<e.layers.length;s+=1){r.push(n);let o=0;for(let i of e.layers[s])o=Math.max(o,i.w);n+=o+t.layerGap}for(let s=0;s<e.layers.length;s+=1)for(let o of e.layers[s])o.x=r[s];for(let s of e.layers){let o=0;for(let i of s)i.y=o,o+=i.h+t.nodeGap}Ze(e,t,"y")}function kt(e,t){let r=[],n=0;for(let s=0;s<e.layers.length;s+=1){r.push(n);let o=0;for(let i of e.layers[s])o=Math.max(o,i.h);n+=o+t.layerGap}for(let s=0;s<e.layers.length;s+=1)for(let o of e.layers[s])o.y=r[s];for(let s of e.layers){let o=0;for(let i of s)i.x=o,o+=i.w+t.nodeGap}Ze(e,t,"x")}function Ze(e,t,r){let n=o=>r==="y"?o.h:o.w,s=t.nodeGap;for(let o=0;o<2;o+=1){let i=o===0?e.layers.slice(1):e.layers.slice(0,-1).reverse();for(let a of i){let l=new Map;for(let d of a){let h=o===0?d.in:d.out;if(h.length===0)continue;let p=[];for(let c of h){let g=e.nodes.get(o===0?c.fromId:c.toId);if(!g)continue;let O=r==="y"?g.y:g.x;p.push(O+Math.floor(n(g)/2))}if(p.length===0)continue;p.sort((c,g)=>c-g);let f=p[Math.floor(p.length/2)];l.set(d.id,f-Math.floor(n(d)/2))}let u=0;for(let d of a){let h=l.get(d.id),p=r==="y"?d.y:d.x,c=Math.max(h??p,u);r==="y"?d.y=c:d.x=c,u=c+n(d)+s}}}}function $t(e,t){let r=new Map;for(let u of e.hops){let d=r.get(u.chainId);d?d.push(u):r.set(u.chainId,[u])}for(let u of r.values())u.sort((d,h)=>d.hopIndex-h.hopIndex);let n=t.direction==="LR",s=u=>n?u.x:u.y,o=u=>n?u.w:u.h,i=u=>n?u.y+Math.floor(u.h/2):u.x+Math.floor(u.w/2),a=new Map;for(let u=0;u+1<e.layers.length;u+=1){let d=e.layers[u],h=e.layers[u+1],p=0;for(let _ of d)p=Math.max(p,s(_)+o(_));let f=Number.POSITIVE_INFINITY;for(let _ of h)f=Math.min(f,s(_));let c=Number.isFinite(f)?f-1:p,g=Math.max(1,c-p+1),O=[];for(let _ of d)for(let R of _.out)O.push(R);O.sort((_,R)=>{let k=i(e.nodes.get(_.fromId)),$=i(e.nodes.get(R.fromId));if(k!==$)return k-$;let D=i(e.nodes.get(_.toId)),G=i(e.nodes.get(R.toId));return D-G});let S=[],b=new Map;for(let _ of O){let R=i(e.nodes.get(_.fromId)),k=i(e.nodes.get(_.toId)),$=Math.min(R,k),D=Math.max(R,k),G=-1;for(let P=0;P<S.length;P+=1){let F=S[P],H=!0;for(let U of F)if(U.lo<=D&&$<=U.hi){H=!1;break}if(H){F.push({lo:$,hi:D}),G=P;break}}G<0&&(S.push([{lo:$,hi:D}]),G=S.length-1),b.set(_,G)}let m=S.length,y=g>=Math.max(3,m+2),x=y?p+1:p,v=y?c-1:c,w=Math.max(1,v-x+1);for(let _ of O){let R=b.get(_),k;if(m<=1)k=x+Math.floor(w/2);else{let $=(w-1)/(m-1);k=x+Math.floor(R*$)}a.set(_,Math.max(p,Math.min(c,k)))}}let l=[];for(let[,u]of r){let d=[];for(let p=0;p<u.length;p+=1){let f=u[p],c=e.nodes.get(f.fromId),g=e.nodes.get(f.toId),O=a.get(f),S=c.isVirtual?s(c):s(c)+o(c),b=g.isVirtual?s(g):s(g)-1,m=i(c),y=i(g);p===0&&le(d,n,S,m),m!==y&&(le(d,n,O,m),le(d,n,O,y)),le(d,n,b,y)}let h=u[0];l.push({from:h.chainFrom,to:h.chainTo,points:Nt(d)})}return l}function le(e,t,r,n){e.push(t?{x:r,y:n}:{x:n,y:r})}function Nt(e){let t=[];for(let r of e){let n=t[t.length-1];(!n||n.x!==r.x||n.y!==r.y)&&t.push(r)}return t}function Tt(e){let t=0,r=0;for(let n of e.layers)for(let s of n)t=Math.max(t,s.x+s.w),r=Math.max(r,s.y+s.h);return{width:t,height:r}}var At=24,Pt=4,Mt=1,Lt=3;function et(e,t){let r=It(t.direction),n=Math.max(3,t.maxLabelWidth??At),s=t.asciiCharset??"unicode",o=Object.keys(e.nodes).sort(),i=new Set(o),a=e.edges.filter(f=>i.has(f.from)&&i.has(f.to)),l=new Map,u=new Map;for(let f of o){let c=ze(f,n);l.set(f,c),u.set(f,ae(c)+4)}let d=Qe({nodes:o,edges:a,widthCells:f=>u.get(f)??3,heightCells:()=>Lt,layerGap:Pt,nodeGap:Mt,direction:r}),h=Ue(d,{charset:s,labelOf:f=>l.get(f)??f}),p=t.logger;return p&&p(h),h}function It(e){if(e===void 0||e==="LR")return"LR";if(e==="TD")return"TD";throw new Error(`ascii describe supports direction "LR" or "TD" only; got ${String(e)}`)}var T="::",B="__meta__",q=1;function tt(e,t){let r=Math.max(16,e.size*4),n=0;for(;e.size>0;){if(n++>=r){console.error(`[Graph "${t}".destroy] disposer drain exceeded cap (${r}); ${e.size} disposer(s) discarded`),e.clear();return}let s=e.values().next();if(s.done)return;let o=s.value;e.delete(o);try{o()}catch(i){console.error(`[Graph "${t}".destroy] disposer threw:`,i)}}}function st(e){return e!=null&&typeof e=="object"&&"cache"in e&&typeof e.subscribe=="function"&&typeof e.down=="function"}function jt(e){if(e!=null)return st(e)?e.cache:e}function Bt(e){let t=[];for(let r of Object.keys(e).sort()){let n=e[r].v;n!=null&&t.push(`${r} ${n.id} ${n.version}`)}return t.join(`
|
|
4
|
-
`)}function nt(e){if(e.version!==q)throw new Error(`unsupported snapshot version ${String(e.version)} (expected ${q})`);for(let t of["name","nodes","edges","subgraphs"])if(!(t in e))throw new Error(`snapshot missing required key "${t}"`);if(typeof e.name!="string")throw new TypeError("snapshot 'name' must be a string");if(typeof e.nodes!="object"||e.nodes===null||Array.isArray(e.nodes))throw new TypeError("snapshot 'nodes' must be an object");if(!Array.isArray(e.edges))throw new TypeError("snapshot 'edges' must be an array");if(!Array.isArray(e.subgraphs))throw new TypeError("snapshot 'subgraphs' must be an array")}function Ft(e,t){let r=new WeakMap,n=(s,o)=>{if(Object.is(s,o))return!0;if(s==null||o==null||typeof s!="object"||typeof o!="object")return!1;let i=r.get(s);if(i==null&&(i=new WeakSet,r.set(s,i)),i.has(o))return!0;i.add(o);let a=s.constructor,l=o.constructor;if(a!==l)return!1;if(s instanceof Date)return s.getTime()===o.getTime();if(s instanceof RegExp)return s.source===o.source&&s.flags===o.flags;if(Array.isArray(s)){let p=o;if(s.length!==p.length)return!1;for(let f=0;f<s.length;f++)if(!n(s[f],p[f]))return!1;return!0}if(s instanceof Map){let p=o;if(s.size!==p.size)return!1;for(let[f,c]of s)if(!p.has(f)||!n(c,p.get(f)))return!1;return!0}if(s instanceof Set){let p=o;if(s.size!==p.size)return!1;for(let f of s){let c=!1;for(let g of p)if(n(f,g)){c=!0;break}if(!c)return!1}return!0}if(ArrayBuffer.isView(s)){let p=s,f=o;if(p.length!==f.length)return!1;for(let c=0;c<p.length;c++)if(p[c]!==f[c])return!1;return!0}let u=Object.keys(s),d=Object.keys(o);if(u.length!==d.length)return!1;let h=new Set(d);for(let p of u)if(!h.has(p)||!n(s[p],o[p]))return!1;return!0};return n(e,t)}function De(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(De);let t=e,r=Object.keys(t).sort(),n={};for(let s of r)n[s]=De(t[s]);return n}function Ht(e){return e.replaceAll("\\","\\\\").replaceAll('"','\\"')}function Vt(e){return e.replaceAll("\\","\\\\").replaceAll('"','\\"')}function zt(e){return e==="TD"?"down":e==="BT"?"up":e==="RL"?"left":"right"}function it(e){let t=new Set,r=[];function n(s,o){let i=`${s}\0${o}`;t.has(i)||(t.add(i),r.push([s,o]))}for(let[s,o]of Object.entries(e.nodes)){let i=o.deps;if(i)for(let a of i)n(a,s)}for(let s of e.edges)n(s.from,s.to);return r}function at(e){if(e===void 0)return"LR";if(e==="TD"||e==="LR"||e==="BT"||e==="RL")return e;throw new Error(`invalid diagram direction ${String(e)}; expected one of: TD, LR, BT, RL`)}function Kt(e,t){let r=t.includeEdges??!0,n=t.includeSubgraphs??!0,{expand:s,...o}=e,i={...o,edges:r?e.edges:[],subgraphs:n?e.subgraphs:[]},a=JSON.stringify(De(i),null,t.indent??2);return t.logger?.(a),a}function Wt(e,t){let r=t.includeEdges??!0,n=t.includeSubgraphs??!0,s=[];s.push(`Graph ${e.name}`),s.push("Nodes:");for(let i of Object.keys(e.nodes).sort()){let a=e.nodes[i];s.push(`- ${i} (${a.type}/${a.status}): ${de(a.value)}`)}if(r){s.push("Edges:");for(let i of e.edges)s.push(`- ${i.from} -> ${i.to}`)}if(n){s.push("Subgraphs:");for(let i of e.subgraphs)s.push(`- ${i}`)}let o=s.join(`
|
|
5
|
-
`);return t.logger?.(o),o}function ut(e,t){let r=at(t.direction),n=Object.keys(e.nodes).sort(),s=new Map;for(let i=0;i<n.length;i+=1)s.set(n[i],`n${i}`);let o=[`flowchart ${r}`];for(let i of n){let a=s.get(i);o.push(` ${a}["${Ht(i)}"]`)}for(let[i,a]of it(e)){let l=s.get(i),u=s.get(a);!l||!u||o.push(` ${l} --> ${u}`)}return o.join(`
|
|
6
|
-
`)}function qt(e,t){let r=ut(e,t);return Ut(r)}function Ut(e,t){let r=t?.theme??"default",n=t?.autoSync??!0,o=JSON.stringify({code:e,mermaid:{theme:r},autoSync:n}),i=new TextEncoder().encode(o),a="";for(let u=0;u<i.length;u++)a+=String.fromCharCode(i[u]);return`https://mermaid.live/edit#base64:${globalThis.btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}function Jt(e,t){let r=at(t.direction),n=Object.keys(e.nodes).sort(),s=new Map;for(let i=0;i<n.length;i+=1)s.set(n[i],`n${i}`);let o=[`direction: ${zt(r)}`];for(let i of n){let a=s.get(i);o.push(`${a}: "${Vt(i)}"`)}for(let[i,a]of it(e)){let l=s.get(i),u=s.get(a);!l||!u||o.push(`${l} -> ${u}`)}return o.join(`
|
|
7
|
-
`)}function Yt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ce(e){let t="^";for(let r=0;r<e.length;r+=1){let n=e[r];if(n==="*"){t+=".*";continue}if(n==="?"){t+=".";continue}if(n==="["){let s=e.indexOf("]",r+1);if(s<=r+1){t+="\\[";continue}let o=e.slice(r+1,s);o.startsWith("!")&&(o=`^${o.slice(1)}`),o=o.replace(/\\/g,"\\\\"),t+=`[${o}]`,r=s;continue}t+=Yt(n)}return t+="$",new RegExp(t)}var Xt={data:"\x1B[32m",dirty:"\x1B[33m",resolved:"\x1B[36m",invalidate:"\x1B[93m",pause:"\x1B[90m",resume:"\x1B[96m",complete:"\x1B[34m",error:"\x1B[31m",teardown:"\x1B[91m",derived:"\x1B[35m",path:"\x1B[90m",reset:"\x1B[0m"},Qt={data:"",dirty:"",resolved:"",invalidate:"",pause:"",resume:"",complete:"",error:"",teardown:"",derived:"",path:"",reset:""};function de(e){if(typeof e=="string")return JSON.stringify(e);if(typeof e=="number"||typeof e=="boolean"||e==null)return String(e);try{return JSON.stringify(e)}catch{return"[unserializable]"}}function Zt(e){return e==="none"?Qt:e==="ansi"||e==null?Xt:{data:e.data??"",dirty:e.dirty??"",resolved:e.resolved??"",invalidate:e.invalidate??"",pause:e.pause??"",resume:e.resume??"",complete:e.complete??"",error:e.error??"",teardown:e.teardown??"",derived:e.derived??"",path:e.path??"",reset:e.reset??""}}function rt(e){if(e==null)return{};let t=e.detail;return t==="full"?{...e,structured:e.structured??!0,timeline:e.timeline??!0,causal:e.causal??!0,derived:e.derived??!0}:t==="minimal"?{...e,structured:e.structured??!0}:e.format==="stage-log"?{...e,structured:e.structured??!0,timeline:e.timeline??!0}:e}function en(e,t,r){for(let n=0;n<e.length;n++){let s=e.charCodeAt(n);if(s<32||s===127)throw new Error(`Graph "${t}": ${r} "${e}" must not contain control character (U+${s.toString(16).padStart(4,"0").toUpperCase()} at index ${n})`)}}function Ge(e,t,r){if(e==="")throw new Error(`Graph "${t}": ${r} name must be non-empty`);if(e.includes(T))throw new Error(`Graph "${t}": ${r} "${e}" must not contain '${T}' (path separator)`);if(e===B)throw new Error(`Graph "${t}": ${r} name "${B}" is reserved for meta companion paths`);en(e,t,r)}function tn(e,t){if(e==="")throw new Error(`Graph "${t}": resolve path must be non-empty`);let r=e.split(T);for(let n of r)if(n==="")throw new Error(`Graph "${t}": resolve path has empty segment`);return r}function nn(e,t){let r=!1;for(let s of e)if(!t.isMetaPassthrough(s[0])){r=!0;break}return r?e.filter(s=>t.isMetaPassthrough(s[0])):e}function lt(e){for(let t of e._mounts.values())lt(t);for(let t of e._nodes.values())try{t.down([[z]],{internal:!0})}catch{}}var Ce=class e{name;opts;config;_nodes=new Map;_nodeToName=new WeakMap;_mounts=new Map;_parent=void 0;_storageDisposers=new Set;_disposers=new Set;_destroyed=!1;_topology;_topologyEmitters=new Set;constructor(t,r){if(t==="")throw new Error("Graph name must be non-empty");if(t.includes(T))throw new Error(`Graph name must not contain '${T}' (got "${t}")`);if(t===B)throw new Error(`Graph name "${B}" is reserved for meta companion paths`);this.name=t,this.opts=Object.freeze({...r??{}}),this.config=r?.config??we,this._traceRing=new Se(r?.traceCapacity??1e3),r?.versioning!=null&&this.setVersioning(r.versioning)}ancestors(t=!0){let r=[],n=t?this:this._parent;for(;n!=null;)r.push(n),n=n._parent;return r}get topology(){return this._topology==null&&(this._topology=Me(t=>{let r=n=>{t.emit(n)};return this._topologyEmitters.add(r),()=>{this._topologyEmitters.delete(r)}},{name:`${this.name}_topology`})),this._topology}_emitTopology(t){if(!(this._topology==null||this._topologyEmitters.size===0))for(let r of this._topologyEmitters)r(t)}nameOf(t){return this._nodeToName.get(t)}add(t,r){let n=t.name,s=r?.name??n;if(s==null||s==="")throw new Error(`Graph "${this.name}": graph.add requires a non-empty name \u2014 pass via opts.name or set it on the node (e.g. state(0, { name: "x" }))`);let o=s,i=r?.annotation;if(Ge(o,this.name,"add"),this._mounts.has(o))throw new Error(`Graph "${this.name}": name "${o}" is already a mount point`);if(this._nodes.has(o))throw new Error(`Graph "${this.name}": node "${o}" already exists`);let a=this._nodeToName.get(t);if(a!==void 0)throw new Error(`Graph "${this.name}": node instance already registered as "${a}"`);return this._nodes.set(o,t),this._nodeToName.set(t,o),this._emitTopology({kind:"added",name:o,nodeKind:"node"}),i!=null&&(this._annotations.set(o,i),this.config.inspectorEnabled&&this._traceRing.push({path:o,annotation:i,timestamp_ns:K()})),t}setVersioning(t){if(t!=null)for(let r of this._nodes.values())r instanceof L&&r._applyVersioning(t)}remove(t){Ge(t,this.name,"remove");let r=this._mounts.get(t);if(r){let o={kind:"mount",nodes:[],mounts:[]},i=[];r._collectObserveTargets("",i);for(let[a,l]of i)a.includes(`${T}${B}${T}`)||o.nodes.push(a);return o.nodes.sort(),o.mounts.push(t),o.mounts.push(...r._collectSubgraphs(`${t}${T}`)),this._mounts.delete(t),r._parent=void 0,lt(r),this._emitTopology({kind:"removed",name:t,nodeKind:"mount",audit:o}),o}let n=this._nodes.get(t);if(!n)throw new Error(`Graph "${this.name}": unknown node or mount "${t}"`);this._nodes.delete(t),this._nodeToName.delete(n),n.down([[z]],{internal:!0});let s={kind:"node",nodes:[t],mounts:[]};return this._emitTopology({kind:"removed",name:t,nodeKind:"node",audit:s}),s}removeAll(t){let r=typeof t=="function"?t:(()=>{let o=ce(t);return i=>o.test(i)})(),n={kind:"mount",nodes:[],mounts:[]},s=[...this._nodes.keys(),...this._mounts.keys()].filter(o=>r(o));for(let o of s){let i=this.remove(o);n.nodes.push(...i.nodes),n.mounts.push(...i.mounts)}return n.nodes.sort(),n.mounts.sort(),n}[Symbol.iterator](){let t=[...this._nodes.keys()].sort(),r=this._nodes,n=0;return{[Symbol.iterator](){return this},next(){if(n>=t.length)return{value:void 0,done:!0};let s=t[n++];return{value:[s,r.get(s)],done:!1}}}}node(t){if(t==="")throw new Error(`Graph "${this.name}": node name must be non-empty`);if(t.includes(T))return this.resolve(t);let r=this._nodes.get(t);if(!r)throw new Error(`Graph "${this.name}": unknown node "${t}"`);return r}get(t){return this.node(t).cache}set(t,r,n){let s=n?.internal===!0;this.node(t).down([[Y,r]],{actor:n?.actor,internal:s,delivery:"write"})}setAll(t,r){let n=Symbol.iterator in t?t:Object.entries(t);Ae(()=>{for(let[s,o]of n)this.set(s,o,r)})}invalidate(t,r){let n=r?.internal===!0;this.node(t).down([[te]],{actor:r?.actor,internal:n,delivery:"write"})}error(t,r,n){let s=n?.internal===!0;this.node(t).down([[Q,r]],{actor:n?.actor,internal:s,delivery:"write"})}complete(t,r){let n=r?.internal===!0;this.node(t).down([[X]],{actor:r?.actor,internal:n,delivery:"write"})}edges(t){let r=t?.recursive===!0,n=new Map;if(!r){for(let[l,u]of this._nodes)n.set(u,l);let a=[];for(let[l,u]of this._nodes)if(u instanceof L)for(let d of u._deps){let h=n.get(d.node);h!=null&&a.push([h,l])}return a.sort((l,u)=>l[0]<u[0]?-1:l[0]>u[0]?1:l[1]<u[1]?-1:l[1]>u[1]?1:0),a}let s=[];this._collectObserveTargets("",s);let o=new Map;for(let[a,l]of s)o.set(l,a);let i=[];for(let[a,l]of s)if(l instanceof L)for(let u of l._deps){let d=o.get(u.node);d!=null&&i.push([d,a])}return i.sort((a,l)=>a[0]<l[0]?-1:a[0]>l[0]?1:a[1]<l[1]?-1:a[1]>l[1]?1:0),i}mount(t,r){if(r===void 0){let s=new e(t);return this.mount(t,s)}if(typeof r=="function"){let s=new e(t);return r(s),this.mount(t,s)}let n=r;if(Ge(t,this.name,"mount"),this._nodes.has(t))throw new Error(`Graph "${this.name}": cannot mount at "${t}" \u2014 node with that name exists`);if(this._mounts.has(t))throw new Error(`Graph "${this.name}": mount "${t}" already exists`);if(n===this)throw new Error(`Graph "${this.name}": cannot mount a graph into itself`);if(n._parent!=null)throw new Error(`Graph "${this.name}": this child graph is already mounted on "${n._parent.name}"`);for(let s=this;s!=null;s=s._parent)if(s===n)throw new Error(`Graph "${this.name}": mount("${t}", \u2026) would create a mount cycle`);return this._mounts.set(t,n),n._parent=this,this._emitTopology({kind:"added",name:t,nodeKind:"mount"}),n}resolve(t){let r=tn(t,this.name);return this._resolveFromSegments(r)}tryResolve(t){try{return this.resolve(t)}catch{return}}_resolveFromSegments(t){let r=t;if(r[0]===this.name&&(r=r.slice(1),r.length===0))throw new Error(`Graph "${this.name}": resolve path ends at graph name only`);let n=r[0],s=r.slice(1);if(s.length===0){let a=this._nodes.get(n);if(a)return a;throw this._mounts.has(n)?new Error(`Graph "${this.name}": path ends at subgraph "${n}" \u2014 not a node (GRAPHREFLY-SPEC \xA73.5)`):new Error(`Graph "${this.name}": unknown name "${n}"`)}let o=this._nodes.get(n);if(o&&s.length>0&&s[0]===B)return this._resolveMetaChainFromNode(o,s,r.join(T));let i=this._mounts.get(n);if(!i)throw this._nodes.has(n)?new Error(`Graph "${this.name}": "${n}" is a node; trailing path "${s.join(T)}" is invalid`):new Error(`Graph "${this.name}": unknown mount or node "${n}"`);return i.resolve(s.join(T))}_resolveMetaChainFromNode(t,r,n){let s=t,o=0,i=[...r];for(;o<i.length;){if(i[o]!==B)throw new Error(`Graph "${this.name}": expected ${B} segment in meta path "${n}"`);if(o+1>=i.length)throw new Error(`Graph "${this.name}": meta path requires a key after ${B} in "${n}"`);let a=i[o+1],l=s.meta[a];if(!l)throw new Error(`Graph "${this.name}": unknown meta "${a}" in path "${n}"`);s=l,o+=2}return s}signal(t,r){if(r?.internal!==!0){for(let s of t)if(this.config.messageTier(s[0])===3)throw new Error(`Graph "${this.name}": Graph.signal() rejects tier-3 messages (DATA / RESOLVED). Broadcast is for control-plane tiers (START / DIRTY / INVALIDATE / PAUSE / RESUME / COMPLETE / ERROR / TEARDOWN). For per-node value writes, use Graph.set or graph.node(name).down(...).`)}let n=[];if(this._signalDeliver(t,r??{},new Set,n),n.length>0)throw n[0]}_signalDeliver(t,r,n,s){for(let l of this._mounts.values())l._signalDeliver(t,r,n,s);let i=r.internal===!0?{internal:!0}:{actor:r.actor,delivery:"signal"},a=nn(t,this.config);for(let l of[...this._nodes.keys()].sort()){let u=this._nodes.get(l);if(!n.has(u)){n.add(u);try{u.down(t,i)}catch(d){if(d instanceof W)throw d;s.push(d)}a.length!==0&&this._signalMetaSubtree(u,a,n,i,s)}}}_signalMetaSubtree(t,r,n,s,o){for(let i of Object.keys(t.meta).sort()){let a=t.meta[i];if(!n.has(a)){n.add(a);try{a.down(r,s)}catch(l){if(l instanceof W)throw l;o.push(l)}this._signalMetaSubtree(a,r,n,s,o)}}}describe(t){if(t?.reactive===!0)return this._describeReactive(t);let r=jt(t?.actor),n=t?.filter,s=re(t?.detail,t?.fields),o=t?.format==="spec",i=o?re("minimal"):s,a=[];this._collectObserveTargets("",a);let l=new Map;for(let[v,w]of a)l.set(w,v);let u=[];{let v=a.map(([,R])=>R),w=new Set(l.values()),_=0;for(;v.length>0;){let R=v.shift();if(R instanceof L)for(let k of R._deps){let $=k.node;if(l.has($))continue;let D=$.name??"",G=D;if(!G||w.has(G))if(D){let P=2;for(;w.has(`${D}#${P}`);)P++;G=`${D}#${P}`}else for(G=`__internal__/${_++}`;w.has(G);)G=`__internal__/${_++}`;l.set($,G),w.add(G),u.push([G,$]),v.push($)}}}let d=[...a,...u],h={};for(let[v,w]of d){if(r!=null&&!w.allowsObserve(r))continue;let _=_e(w,i),R=w instanceof L?w._deps.map(G=>l.get(G.node)??G.node.name??""):[],{name:k,...$}=_,D={...$,deps:R};if(!o){let G=this._annotations.get(v);G!=null&&(D.annotation=G)}if(n!=null)if(typeof n=="function"){let G=n;if(!(G.length>=2?G(v,D):G(D)))continue}else{let G=!0;for(let[P,F]of Object.entries(n)){let H=P==="deps_includes"?"depsIncludes":P==="meta_has"?"metaHas":P;if(H==="depsIncludes"){if(!D.deps.includes(String(F))){G=!1;break}continue}if(H==="metaHas"){if(!Object.hasOwn(D.meta??{},String(F))){G=!1;break}continue}if(D[H]!==F){G=!1;break}}if(!G)continue}h[v]=D}let p=new Set(Object.keys(h)),f=[];for(let[v,w]of d)if(w instanceof L)for(let _ of w._deps){let R=l.get(_.node);R!=null&&f.push([R,v])}f.sort((v,w)=>v[0]<w[0]?-1:v[0]>w[0]?1:v[1]<w[1]?-1:v[1]>w[1]?1:0);let c=f.map(([v,w])=>({from:v,to:w}));(r!=null||n!=null)&&(c=c.filter(v=>p.has(v.from)&&p.has(v.to)));let g=this._collectSubgraphs(""),O=r!=null||n!=null?g.filter(v=>{let w=`${v}${T}`;return[...p].some(_=>_===v||_.startsWith(w))}):g,S=this,b=t,m={name:this.name,nodes:h,edges:c,subgraphs:O,expand(v){let w={...b,format:void 0};return Array.isArray(v)?(w.fields=v,w.detail=void 0):(w.detail=v,w.fields=void 0),S.describe(w)}},y=t??{},x=y.format;return x==="json"?Kt(m,y):x==="pretty"?Wt(m,y):x==="mermaid"?ut(m,y):x==="mermaid-url"?qt(m,y):x==="d2"?Jt(m,y):x==="ascii"?et(m,y):m}_collectSubgraphs(t){let r=[];for(let n of[...this._mounts.keys()].sort()){let s=t===""?n:`${t}${n}`;r.push(s),r.push(...this._mounts.get(n)._collectSubgraphs(`${s}${T}`))}return r}resourceProfile(t){return Ve(this,t)}reachable(t,r,n={}){return n.withDetail===!0?ot(this.describe(),t,r,{...n,withDetail:!0}):ot(this.describe(),t,r,n)}explain(t,r,n){return n?.reactive===!0?this._explainReactive(t,r,n):this._explainStatic(t,r,n)}_explainStatic(t,r,n){let s=this.describe({detail:"full"}),o=new Map(this._annotations),i=new Map;for(let[a,l]of Object.entries(s.nodes))l.lastMutation!=null&&i.set(a,l.lastMutation);return Ie(s,t,r,{...n?.maxDepth!=null?{maxDepth:n.maxDepth}:{},...n?.findCycle===!0?{findCycle:!0}:{},annotations:o,lastMutations:i})}_describeReactive(t){let r={...t,reactive:!1},n=t.reactiveName??"describe",s=0,o=ne(s,{name:`${n}_version`}),i=this.observe({timeline:!0,structured:!0}),a=!1,l=!1,u=()=>{a||l||(a=!0,xe(()=>{a=!1,!l&&(s+=1,o.emit(s))}))},d=i.onEvent(b=>{let m=b.type;m!=="data"&&m!=="error"&&m!=="complete"&&m!=="teardown"||u()}),h=[],p=new WeakSet,f=b=>{if(p.has(b)||l)return;p.add(b);let m=b.topology.subscribe(y=>{for(let x of y){if(x[0]!==Y)continue;let v=x[1];if(u(),v.kind==="added"&&v.nodeKind==="mount"){let w=b._mounts.get(v.name);w!=null&&f(w)}}});h.push(m);for(let y of b._mounts.keys()){let x=b._mounts.get(y);x!=null&&f(x)}};f(this);let c,g=t.actor;st(g)&&(c=g.subscribe(b=>{let m=!1,y=!1;for(let x of b){let v=x[0];v===Y?m=!0:(v===X||v===Q||v===z)&&(y=!0)}m&&u(),y&&(c?.(),c=void 0,u())}));let O;try{O=Oe([o],()=>this.describe(r),{name:n,describeKind:"derived",meta:{domain:"audit",kind:"describe"},equals:(b,m)=>b===m})}catch(b){d(),c?.();for(let m of h)m();throw i.dispose(),b}let S=Ee(O);return{node:O,dispose(){l=!0,d(),c?.();for(let b of h)b();h.length=0,i.dispose(),S()}}}_explainReactive(t,r,n){let s=0,o=ne(s,{name:"explain_version"}),i=this.observe({timeline:!0,structured:!0}),a=!1,l=!1,u=i.onEvent(f=>{let c=f.type;c!=="data"&&c!=="error"&&c!=="complete"&&c!=="teardown"||a||l||(a=!0,xe(()=>{a=!1,!l&&(s+=1,o.emit(s))}))}),d={...n?.maxDepth!=null?{maxDepth:n.maxDepth}:{},...n?.findCycle===!0?{findCycle:!0}:{}},h;try{h=Oe([o],()=>this._explainStatic(t,r,d),{name:n?.name??"explain",describeKind:"derived",meta:{domain:"audit",kind:"explain_path",from:t,to:r},equals:(f,c)=>f.found===c.found&&f.reason===c.reason&&f.steps.length===c.steps.length&&on(f.steps,c.steps)})}catch(f){throw u(),i.dispose(),f}let p=Ee(h);return{node:h,dispose(){l=!0,u(),i.dispose(),p()}}}_pathsMatching(t){let r=ce(t),n=[];return this._collectObserveTargets("",n),n.map(([s])=>s).filter(s=>r.test(s))}_collectObserveTargets(t,r){for(let n of[...this._mounts.keys()].sort()){let s=t===""?n:`${t}${T}${n}`;this._mounts.get(n)._collectObserveTargets(s,r)}for(let n of[...this._nodes.keys()].sort()){let s=this._nodes.get(n),o=t===""?n:`${t}${T}${n}`;r.push([o,s]),this._appendMetaObserveTargets(o,s,r)}}_appendMetaObserveTargets(t,r,n){for(let s of Object.keys(r.meta).sort()){let o=r.meta[s],i=`${t}${T}${B}${T}${s}`;n.push([i,o]),this._appendMetaObserveTargets(i,o,n)}}observe(t,r){let n=typeof t=="string",o=rt(n?r:t),i=o.structured===!0||o.timeline===!0||o.causal===!0||o.derived===!0||o.detail==="minimal"||o.detail==="full"||o.format!=null,a=o.actor;if(n){let d=t,h=this.resolve(d);if(a!=null&&!h.allowsObserve(a))throw new W({actor:a,action:"observe",nodeName:d});return i?this._buildStructuredObserver([[d,h]],o,"one"):{subscribe(p){return h.subscribe(p)},up(p){try{h.up?.(p)}catch(f){if(f instanceof W)return;throw f}}}}let l=[];this._collectObserveTargets("",l),l.sort((d,h)=>d[0]<h[0]?-1:d[0]>h[0]?1:0);let u=a==null?l:l.filter(([,d])=>d.allowsObserve(a));return i?this._buildStructuredObserver(u,o,"all"):{subscribe:d=>{let h=u.map(([p,f])=>f.subscribe(c=>{d(p,c)}));return()=>{for(let p of h)p()}},up:(d,h)=>{try{this.resolve(d).up?.(h)}catch(p){if(p instanceof W)return;throw p}}}}_buildStructuredObserver(t,r,n){let s=n==="one"?t[0]?.[0]:void 0,o=i=>{if(n==="one"&&s!=null){let d=this.resolve(s);return this._buildStructuredObserver([[s,d]],i,"one")}let a=[];this._collectObserveTargets("",a),a.sort((d,h)=>d[0]<h[0]?-1:d[0]>h[0]?1:0);let l=i.actor,u=l==null?a:a.filter(([,d])=>d.allowsObserve(l));return this._buildStructuredObserver(u,i,"all")};return this._createObserveResult(t,r,o)}_createObserveResult(t,r,n){let s=r.timeline===!0,o=r.causal===!0,i=r.derived===!0,a=r.detail==="minimal",l=this.config.inspectorEnabled,u=(o||i)&&l,d=r.maxEvents,h=d!=null&&d>0?new Se(d):null,p=[],f=new Set,c={},g=new Set,O=0,S=0,b=0,m=0,y=0,x=0,v=!1,w=!1,_=0,R=new Map,k=new Map,$=new Map,D=E=>{h?h.push(E):p.push(E);for(let N of f)N(E)},G=()=>s?{timestamp_ns:K(),in_batch:Te(),batch_id:_}:{},P=(E,N)=>{if(!(!u||!(E instanceof L)))return E._setInspectorHook(I=>{if(I.kind==="dep_message")R.set(E,I.depIndex);else if(I.kind==="run"){let J=I.batchData.map((C,M)=>C!=null&&C.length>0?C.at(-1):I.prevData[M]);k.set(E,J);let j=I.batchData.map(C=>C!=null?[...C]:void 0);$.set(E,j),i&&D({type:"derived",path:N,dep_values:J,dep_batches:j,...G()})}})},F=E=>{let N=R.get(E),I=k.get(E);if(!o||I==null)return{};let j=(N!=null&&N>=0&&E instanceof L?E._deps[N]:void 0)?.node,C=j?.v,M=$.get(E);return{trigger_dep_index:N,trigger_dep_name:j?.name,...C!=null?{trigger_version:{id:C.id,version:C.version}}:{},dep_values:[...I],...M!=null?{dep_batches:M}:{}}},H=[],U=[];for(let[E,N]of t){let I=P(N,E);I&&H.push(I),U.push(N.subscribe(J=>{_++;for(let j of J){let C=j[0],M=G();if(C===Y){c[E]=j[1];let ge=N instanceof L?N.lastMutation?.actor??Z:Z;D({type:"data",path:E,data:j[1],actor:ge,...M,...F(N)})}else if(a)C===me?O++:C===be?S++:C===te?b++:C===ye?m++:C===ve?y++:C===z?x++:C===X&&!g.has(E)?v=!0:C===Q&&(w=!0,g.add(E));else if(C===me)O++,D({type:"dirty",path:E,...M});else if(C===be)S++,D({type:"resolved",path:E,...M,...F(N)});else if(C===te)b++,D({type:"invalidate",path:E,...M});else if(C===ye)m++,D({type:"pause",path:E,lockId:j[1],...M});else if(C===ve)y++,D({type:"resume",path:E,lockId:j[1],...M});else if(C===X)g.has(E)||(v=!0),D({type:"complete",path:E,...M});else if(C===Q){w=!0,g.add(E);let ge=N instanceof L?N.lastMutation?.actor??Z:Z;D({type:"error",path:E,data:j[1],actor:ge,...M})}else C===z&&(x++,D({type:"teardown",path:E,...M}))}}))}let fe=!1,pe=()=>{if(!fe){fe=!0;for(let E of U)E();for(let E of H)E();for(let E of ee)E({value:void 0,done:!0});ee.length=0}},he=[],ee=[];f.add(E=>{let N=ee.shift();N?N({value:E,done:!1}):he.push(E)});let ke={get values(){return c},get dirtyCount(){return O},get resolvedCount(){return S},get invalidateCount(){return b},get pauseCount(){return m},get resumeCount(){return y},get teardownCount(){return x},get events(){return h?h.toArray():[...p]},get anyCompletedCleanly(){return v},get anyErrored(){return w},get completedWithoutErrors(){return v&&!w},onEvent(E){return f.add(E),()=>f.delete(E)},dispose:pe,expand(E){pe();let N={...r};return typeof E=="string"?N.detail=E:Object.assign(N,E),n(rt(N))},[Symbol.asyncIterator](){return{next(){return he.length>0?Promise.resolve({value:he.shift(),done:!1}):fe?Promise.resolve({value:void 0,done:!0}):new Promise(E=>ee.push(E))},return(){return pe(),Promise.resolve({value:void 0,done:!0})}}}};return r.format!=null&&this._attachFormatLogger(ke,r),ke}_attachFormatLogger(t,r){let n=r.format;if(n==null)return;let s=r.logger??(c=>console.log(c)),o=r.includeTypes?new Set(r.includeTypes):null,i=r.excludeTypes?new Set(r.excludeTypes):null,a=o==null&&i==null?()=>!0:c=>(o==null||o.has(c))&&(i==null||!i.has(c)),l=Zt(r.theme),u=n==="stage-log"?K():0,d=c=>c==null?"":r.stageLabels?.[c]??c,h=(c,g)=>c.length>g?`${c.slice(0,g-1)}\u2026`:c,p=c=>c.type==="data"||c.type==="error"?h(de(c.data),120):"",f=c=>{if(n==="stage-log"){let w=(K()-u)/1e9,_=d(c.path).padEnd(9);if(c.type==="data"){let R=p(c);return`[${w.toFixed(3)}s] ${_} \u2190${R?` ${R}`:""}`}if(c.type==="error"){let R=p(c);return`[${w.toFixed(3)}s] ${_} \u2717${R?` ${R}`:""}`}return c.type==="complete"?`[${w.toFixed(3)}s] ${_} \u25A0 complete`:`[${w.toFixed(3)}s] ${_} ${c.type}`}if(n==="json")try{return JSON.stringify(c)}catch{return JSON.stringify({type:c.type,path:c.path,data:"[unserializable]"})}let g=l[c.type]??"",O=c.path?`${l.path}${c.path}${l.reset} `:"",S=c.type==="data"||c.type==="error",b=c.type==="pause"||c.type==="resume",m=S?` ${de(c.data)}`:b?` ${de(c.lockId)}`:"",y=c.type==="data"||c.type==="resolved"||c.type==="derived"?c:void 0,x=y?.trigger_dep_name!=null?` <- ${y.trigger_dep_name}`:y?.trigger_dep_index!=null?` <- #${y.trigger_dep_index}`:"",v=c.in_batch?" [batch]":"";return`${O}${g}${c.type.toUpperCase()}${l.reset}${m}${x}${v}`};t.onEvent(c=>{a(c.type)&&s(f(c),c)})}addDisposer(t){return this._disposers.add(t),()=>{this._disposers.delete(t)}}destroy(){tt(this._disposers,this.name),this.signal([[z]],{internal:!0}),tt(this._storageDisposers,this.name);for(let t of[...this._mounts.values()])t._parent=void 0,t._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}get destroyed(){return this._destroyed}_destroyClearOnly(){for(let t of[...this._mounts.values()])t._parent=void 0,t._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}snapshot(t){let{expand:r,...n}=this.describe({detail:"full"}),s={};for(let a of Object.keys(n.nodes).sort()){let{lastMutation:l,guard:u,...d}=n.nodes[a];s[a]=d}let o=[...n.subgraphs].sort(),i={...n,version:1,nodes:s,subgraphs:o};if(t?.format==null)return i;if(t.format==="json-string")return JSON.stringify(i);if(t.format==="bytes"){if(t.codec==null)throw new Error("snapshot({format: 'bytes'}) requires a `codec` name");let a=this.config.lookupCodec(t.codec);if(a==null)throw new Error(`snapshot: codec "${t.codec}" is not registered on this graph's config. Call config.registerCodec(...) before creating nodes.`);return $e(a,a.encode(i))}throw new Error(`snapshot: unknown format "${String(t.format)}"`)}static decode(t,r){let n=r?.config??we,{codec:s,codecVersion:o,payload:i}=Ne(t,n);return s.decode(i,o)}restore(t,r){if(nt(t),t.name!==this.name)throw new Error(`Graph "${this.name}": restore snapshot name "${t.name}" does not match this graph`);let n=r?.only==null?null:(Array.isArray(r.only)?r.only:[r.only]).map(o=>ce(o)),s=r?.includeProducers===!0;for(let o of Object.keys(t.nodes).sort()){if(n!==null&&!n.some(a=>a.test(o)))continue;let i=t.nodes[o];if(i!==void 0){if(!("value"in i)||i.value===void 0){"value"in i&&i.value===void 0&&r?.onError?.(o,new Error(`restore: slice.value is undefined for "${o}" (undefined is the global SENTINEL; not valid DATA)`));continue}if(!(i.type==="derived"||i.type==="effect")&&!(i.type==="producer"&&!s)){if(i.v!=null){let l=this.tryResolve(o)?.v;if(l!=null&&l.id===i.v.id&&l.version===i.v.version)continue}try{this.set(o,i.value)}catch(a){r?.onError?.(o,a)}}}}}static fromSnapshot(t,r){nt(t);let n=typeof r=="function"?r:r?.build,s=typeof r=="function"?void 0:r?.factories,o=new e(t.name);if(n)return n(o),o.restore(t),o;for(let f of[...t.subgraphs].sort((c,g)=>{let O=c.split(T).length,S=g.split(T).length;return O!==S?O-S:c<g?-1:c>g?1:0})){let c=f.split(T),g=o;for(let O of c)g._mounts.has(O)||g.mount(O,new e(O)),g=g._mounts.get(O)}let i=s?Object.entries(s).map(([f,c])=>({re:ce(f),factory:c})):[],a=f=>{for(let c of i)if(c.re.test(f))return c.factory},l=f=>{let c=f.split(T),g=c.pop();if(g==null||g.length===0)throw new Error(`invalid snapshot path "${f}"`);let O=o;for(let S of c){let b=O._mounts.get(S);if(!b)throw new Error(`unknown mount "${S}" in path "${f}"`);O=b}return[O,g]},u=Object.entries(t.nodes).filter(([f])=>!f.includes(`${T}${B}${T}`)).sort((f,c)=>f[0]<c[0]?-1:f[0]>c[0]?1:0),d=new Map(u),h=new Map,p=!0;for(;d.size>0&&p;){p=!1;for(let[f,c]of[...d.entries()]){let g=c?.deps??[];if(!g.every(x=>h.has(x)))continue;let[O,S]=l(f),b={...c?.meta??{}},m=a(f),y;if(c?.type==="state")y=ne(c.value,{meta:b});else{if(m==null)continue;y=m(S,{path:f,type:c.type,value:c.value,meta:b,deps:g,resolvedDeps:g.map(x=>h.get(x))})}O.add(y,{name:S}),h.set(f,y),d.delete(f),p=!0}}if(d.size>0){let f=[...d.keys()].sort().join(", ");throw new Error(`Graph.fromSnapshot could not reconstruct nodes without build callback: ${f}. Pass matching factories via fromSnapshot(data, { factories: { pattern: factoryFn } }).`)}return o.restore(t),o}toJSON(){return this.snapshot()}attachSnapshotStorage(t,r={}){let n=t.map(u=>({tier:u,debounceMs:Math.max(0,u.debounceMs??0),compactEvery:Math.max(1,u.compactEvery??10),timer:void 0,seq:0,lastSnapshot:void 0,lastFingerprint:"",disposed:!1,savePending:void 0}));r.autoRestore===!0&&this._cascadeRestore(t,r.onError);let s=(u,d)=>{if(u.disposed)return;let h=Bt(d.nodes);if(u.lastSnapshot!=null&&h!==""&&h===u.lastFingerprint)return;let p=u.seq+1,f=Pe(),O=u.lastSnapshot==null||p%u.compactEvery===0?{name:this.name,mode:"full",snapshot:d,seq:p,timestamp_ns:f,format_version:q}:{name:this.name,mode:"diff",diff:rn(u.lastSnapshot,d),seq:p,timestamp_ns:f,format_version:q};if(u.tier.filter&&!u.tier.filter(O))return;let S;try{S=u.tier.save(O)}catch(b){r.onError?.(b,u.tier);return}if(S&&typeof S.then=="function"){let y=(u.savePending??Promise.resolve()).then(()=>S,()=>S).then(()=>{u.disposed||(u.seq=p,u.lastSnapshot=d,u.lastFingerprint=h)},x=>{r.onError?.(x,u.tier)});u.savePending=y.finally(()=>{u.savePending===y&&(u.savePending=void 0)})}else u.seq=p,u.lastSnapshot=d,u.lastFingerprint=h},o=(u,d)=>{try{s(u,d)}catch(h){r.onError?.(h,u.tier)}},i=(u,d)=>{if(!d.some(c=>{let g=this.config.messageTier(c[0]);return g>=3&&g<5}))return;if(r.filter){let c=this.tryResolve(u);if(c==null)return;let g=_e(c,re("standard"));if(!r.filter(u,g))return}let p,f=()=>(p==null&&(p=this.snapshot()),p);for(let c of n)c.disposed||(c.debounceMs===0?o(c,f()):(c.timer==null&&(c.timer=new Le),c.timer.start(c.debounceMs,()=>{c.disposed||o(c,this.snapshot())})))},a;if(r.paths!=null){let d=(typeof r.paths=="string"?this._pathsMatching(r.paths):r.paths).map(h=>{let p=this.tryResolve(h);return p==null?()=>{}:p.subscribe(f=>i(h,f))});a=()=>{for(let h of d)h()}}else a=this.observe().subscribe((u,d)=>i(u,d));let l=()=>{a();for(let u of n)u.disposed=!0,u.timer?.cancel();this._storageDisposers.delete(l)};return this._storageDisposers.add(l),{dispose:l}}async _cascadeRestore(t,r){for(let n of t){let s;try{s=await n.load?.()}catch(i){r?.(i,n);continue}if(s==null||typeof s!="object"||Array.isArray(s))continue;let o=s;try{if(o.mode==="full"&&o.snapshot!=null)return this.restore(o.snapshot),!0;if(o.version===q&&o.nodes!=null)return this.restore(o),!0}catch(i){r?.(i,n)}}return!1}static async fromStorage(t,r,n){for(let s of r){let o;try{o=await s.load?.()}catch(l){n?.onError?.(l,s);continue}if(o==null||typeof o!="object"||Array.isArray(o))continue;let i=o,a=i.mode==="full"&&i.snapshot!=null?i.snapshot:i.version===q&&i.nodes!=null?i:void 0;if(a!=null)try{return e.fromSnapshot(a,n)}catch(l){n?.onError?.(l,s)}}throw new Error(`Graph.fromStorage: no tier held a restorable record for "${t}" across ${r.length} tier(s)`)}_annotations=new Map;_traceRing;trace(t,r,n){if(t!=null&&r!=null){if(this.tryResolve(t)==null)return;if(this._annotations.set(t,r),this.config.inspectorEnabled){let s={path:t,annotation:r,timestamp_ns:K(),...n?.actor!=null?{actor:n.actor}:{}};this._traceRing.push(s)}return}return t!=null?this.config.inspectorEnabled?this._annotations.get(t):void 0:this.config.inspectorEnabled?this._traceRing.toArray():[]}annotation(t){return this._annotations.get(t)}clearTrace(){this._annotations.clear(),this._traceRing.clear()}pruneTrace(t){let r=this._traceRing.toArray().filter(s=>!t(s)),n=this._traceRing.size-r.length;this._traceRing.clear();for(let s of r)this._traceRing.push(s);return n}static diff(t,r){let n=new Set(Object.keys(t.nodes)),s=new Set(Object.keys(r.nodes)),o=[...s].filter(b=>!n.has(b)).sort(),i=[...n].filter(b=>!s.has(b)).sort(),a=[],l=[];for(let b of n){if(!s.has(b))continue;let m=t.nodes[b],y=r.nodes[b],x=m.v,v=y.v;x!=null&&v!=null&&x.id===v.id&&x.version!==v.version&&l.push({path:b,id:x.id,from:x.version,to:v.version});let w=x!=null&&v!=null&&x.id===v.id&&x.version===v.version;for(let _ of["type","status","sentinel"]){let R=m[_],k=y[_];R!==k&&a.push({path:b,field:_,from:R,to:k})}if(!w)for(let _ of["value","meta"]){let R=m[_],k=y[_];Ft(R,k)||a.push({path:b,field:_,from:R,to:k})}}let u=b=>`${b.from} ${b.to}`,d=new Set(t.edges.map(u)),h=new Set(r.edges.map(u)),p=r.edges.filter(b=>!d.has(u(b))),f=t.edges.filter(b=>!h.has(u(b))),c=new Set(t.subgraphs),g=new Set(r.subgraphs),O=[...g].filter(b=>!c.has(b)).sort(),S=[...c].filter(b=>!g.has(b)).sort();return{nodesAdded:o,nodesRemoved:i,nodesChanged:a,versionChanges:l,edgesAdded:p,edgesRemoved:f,subgraphsAdded:O,subgraphsRemoved:S}}};function rn(e,t){let r=Ce.diff(e,t),n={};for(let s of r.nodesAdded){let o=t.nodes[s];o!=null&&(n[s]=o)}return{...r,nodesAddedFull:n}}function ot(e,t,r,n={}){let s={paths:[],depths:new Map,truncated:!1};if(!t)return n.withDetail?s:[];if(!n.both&&r!=="upstream"&&r!=="downstream")throw new Error('reachable: direction must be "upstream" or "downstream"');let o=n.maxDepth;if(o!=null&&(!Number.isInteger(o)||o<0))throw new Error("reachable: maxDepth must be an integer >= 0");if(o===0)return n.withDetail?s:[];let i=new Map,a=new Map,l=new Map,u=new Map,d=new Set;for(let[m,y]of Object.entries(e.nodes)){if(!m)continue;d.add(m);let x=y.deps??[];i.set(m,x);for(let v of x)v&&(d.add(v),a.has(v)||a.set(v,new Set),a.get(v).add(m))}for(let m of e.edges){if(m==null||typeof m!="object")continue;let y=typeof m.from=="string"?m.from:"",x=typeof m.to=="string"?m.to:"";!y||!x||(d.add(y),d.add(x),u.has(y)||u.set(y,new Set),u.get(y).add(x),l.has(x)||l.set(x,new Set),l.get(x).add(y))}if(!d.has(t))return n.withDetail?s:[];let h=n.both===!0,p=m=>{if(h){let w=i.get(m)??[],_=l.get(m),R=a.get(m),k=u.get(m),$=[...w];return _&&$.push(..._),R&&$.push(...R),k&&$.push(...k),$}if(r==="upstream"){let w=i.get(m)??[],_=l.get(m);return _?[...w,..._]:w}let y=a.get(m),x=u.get(m),v=y?[...y]:[];return x&&v.push(...x),v},f=new Set([t]),c=new Map,g=[{path:t,depth:0}],O=0,S=!1;for(;O<g.length;){let m=g[O++];if(o!=null&&m.depth>=o){p(m.path).length>0&&(S=!0);continue}for(let y of p(m.path))!y||f.has(y)||(f.add(y),c.set(y,m.depth+1),g.push({path:y,depth:m.depth+1}))}let b=[...c.keys()].sort((m,y)=>m<y?-1:m>y?1:0);return n.withDetail?{paths:b,depths:c,truncated:S}:b}function on(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let n=e[r],s=t[r];if(n.path!==s.path||n.type!==s.type||n.status!==s.status||n.hop!==s.hop||n.dep_index!==s.dep_index||n.annotation!==s.annotation||n.value!==s.value||n.lastMutation!==s.lastMutation)return!1;let o=n.v,i=s.v;if(o!==i&&(o==null||i==null||o.id!==i.id||o.version!==i.version))return!1}return!0}export{ae as a,Ie as b,A as c,pt as d,He as e,Ve as f,B as g,q as h,Ut as i,Ce as j,rn as k,ot as l};
|
package/dist/chunk-FJ6IEMOS.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as A}from"./chunk-B4L5X2QO.js";import{b as x}from"./chunk-KUVDFOJH.js";import{E as l,m as T,p as f,t as p}from"./chunk-LYCLF26R.js";import{b as R,c as m}from"./chunk-CK2E7BTU.js";var M=p((r,e)=>{r("observe"),r("signal"),e("write")});function N(r){let e=x([],{name:r.name,maxSize:r.retainedLimit??1024,guard:r.guard??M,...r.versioning!=null?{versioning:r.versioning}:{}});return e.withLatest(),r.graph&&r.graph.add(e.entries,{name:r.name}),e}function b(r){if(r===null||typeof r!="object"||Object.isFrozen(r))return r;for(let e of Object.keys(r))b(r[e]);return Object.freeze(r)}function h(r){let e=r.cache,n=(typeof e=="number"&&Number.isFinite(e)?e:0)+1;return r.down([[m],[R,n]]),n}function y(r,e,o,n,a,s){let t=e(o,n,a);if(t===void 0)return;let u=s!=null?{...t,handlerVersion:s}:t;r.append(u)}function q(r,e){let o=e.freeze??!0;return function(...a){let s=o?a.map(b):a,t=f(),u,i,c=!1,g;try{T(()=>{e.seq&&(g=h(e.seq));try{u=r(...s),e.onSuccess&&y(e.audit,e.onSuccess,s,u,{t_ns:t,seq:g},e.handlerVersion)}catch(d){throw i=d,c=!0,d}})}catch(d){if(c&&e.onFailure){let w=i instanceof Error?i.name:typeof i;y(e.audit,e.onFailure,s,i,{t_ns:t,seq:g,errorType:w},e.handlerVersion)}throw c?i:d}return u}}function z(r,e,o=0){let n=l(o,{name:e,describeKind:"state"});return r.add(n,{name:e}),n}function G(r,e,o,n=0){let a={},s=new A(e);for(let t of o){let u=l(n,{name:t,describeKind:"state"});s.add(u,{name:t}),a[t]=u}return r.mount(e,s),a}export{N as a,q as b,z as c,G as d};
|
package/dist/chunk-G6Q3DUMJ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as Qr,b as Xr}from"./chunk-6SVKZ7VI.js";import{$ as Hr,A as hr,B as vr,C as xr,D as Tr,E as wr,F as Er,G as Nr,H as Mr,I as Sr,J as Rr,K as Wr,L as Or,M as Br,N as Ir,O as Lr,P as jr,Q as Cr,R as Vr,S as Pr,T as Ar,U as zr,V as Kr,W as Dr,X as Ur,Y as _r,Z as $r,_ as Fr,a as rn,aa as qr,b as tn,ba as nt,c as Jn,d as Qn,e as Xn,f as Yn,g as Zn,h as er,i as nr,j as rr,k as tr,l as or,m as sr,n as ir,o as ar,p as cr,q as dr,r as fr,s as ur,t as pr,u as lr,v as mr,w as gr,x as br,y as yr,z as kr}from"./chunk-MYFR67PY.js";import{a as Z,b as ee,c as ne,d as re,e as te,f as oe,g as se,h as ie,i as ae,j as ce,k as de}from"./chunk-A5HZZYRK.js";import{b as Yr,c as Zr,d as et,e as it,f as at}from"./chunk-Q7EUZ6NN.js";import{a as xt}from"./chunk-YVYSO5CW.js";import{a as ge,b as Ye}from"./chunk-5QDBSZBV.js";import{a as Y}from"./chunk-ESMPEKEV.js";import{a as ft,b as ut,c as pt,d as lt,e as mt,f as gt,g as bt,h as yt,i as kt,j as ht,k as vt}from"./chunk-D5RFJOZ2.js";import{a as ct,b as dt}from"./chunk-CE72X3WO.js";import{A as Sn,B as Rn,C as Wn,D as On,E as Bn,F as In,G as Ln,I as jn,J as Cn,K as Vn,L as Pn,M as An,N as zn,O as Kn,P as Dn,Q as Un,R as _n,S as $n,T as Fn,U as Hn,V as qn,W as Gn,a as U,b as J,c as on,d as sn,e as an,f as cn,g as dn,h as fn,i as Q,j as un,k as pn,l as ln,m as mn,n as gn,o as bn,p as yn,q as kn,r as hn,s as vn,t as X,u as xn,v as Tn,w as wn,x as En,y as Nn,z as Mn}from"./chunk-JJTF75VS.js";import{c as ke,d as he,e as ve,f as xe,g as Te,h as we,i as Ee}from"./chunk-4VVTGLXJ.js";import{a as rt,b as tt}from"./chunk-NNKJUORL.js";import{a as ot,b as st}from"./chunk-KGKJCHEK.js";import{a as Gr,b as Jr}from"./chunk-TZQPPQEQ.js";import{a as Ze,b as en,c as nn}from"./chunk-KUVDFOJH.js";import{A as Ge,B as Je,C as Qe,D as Xe,a as be,b as ye,c as Ne,d as Me,e as Se,f as G,g as Re,h as We,i as Oe,j as Be,k as Ie,l as Le,m as je,n as Ce,o as Ve,p as Pe,q as Ae,r as ze,s as Ke,t as De,u as Ue,v as _e,w as $e,x as Fe,y as He,z as qe}from"./chunk-MQZWA3DF.js";import{A as K,D as j,E as O,H as D,m as B}from"./chunk-LYCLF26R.js";import{b as h,e as $,f as F,g as H,h as S,i as q,j as W}from"./chunk-CK2E7BTU.js";import{b as me}from"./chunk-QYADASLV.js";var Rt={};me(Rt,{CircuitOpenError:()=>ee,ContentAddressedMissError:()=>Yr,NS_PER_MS:()=>NS_PER_MS,NS_PER_SEC:()=>NS_PER_SEC,NativeIndexBackend:()=>rt,NativeListBackend:()=>ot,NativeLogBackend:()=>Ze,NativeMapBackend:()=>Gr,NativePubSubBackend:()=>_,RateLimiterOverflowError:()=>oe,ResettableTimer:()=>Y,TimeoutError:()=>ae,appendLogStorage:()=>mt,audit:()=>Ln,awaitSettled:()=>qe,buffer:()=>jn,bufferCount:()=>Cn,bufferTime:()=>Pn,cached:()=>$e,canonicalJson:()=>Zr,cascadingCache:()=>Tt,catchError:()=>Gn,checkpointToRedis:()=>Dr,checkpointToS3:()=>Kr,circuitBreaker:()=>ne,combine:()=>hn,combineLatest:()=>Fn,concat:()=>Tn,concatMap:()=>Mn,constant:()=>ke,contentAddressedStorage:()=>et,createTransport:()=>L,createWatermarkController:()=>Ye,csvRows:()=>Tr,debounce:()=>On,debounceTime:()=>Hn,decorrelatedJitter:()=>Te,defer:()=>ze,delay:()=>Wn,deserializeError:()=>A,dictKv:()=>ht,dictSnapshot:()=>vt,distill:()=>Xr,distinctUntilChanged:()=>yn,elementAt:()=>ln,empty:()=>Ve,escapeRegexChar:()=>Ne,exhaustMap:()=>Nn,exponential:()=>ve,externalBundle:()=>tn,externalProducer:()=>rn,fallback:()=>ce,fibonacci:()=>xe,filter:()=>J,find:()=>pn,first:()=>Q,firstValueFrom:()=>Fe,firstWhere:()=>He,flatMap:()=>Rn,forEach:()=>Ke,fromAny:()=>je,fromAsyncIter:()=>Le,fromCSV:()=>xr,fromClickHouseWatch:()=>Nr,fromCron:()=>We,fromDrizzle:()=>Hr,fromEvent:()=>Oe,fromHTTP:()=>Yn,fromHTTPPoll:()=>ir,fromHTTPStream:()=>sr,fromIter:()=>Be,fromKafka:()=>yr,fromKysely:()=>qr,fromMCP:()=>dr,fromNATS:()=>Rr,fromNDJSON:()=>Er,fromOTel:()=>fr,fromPrisma:()=>Fr,fromPrometheus:()=>gr,fromPromise:()=>Ie,fromPulsar:()=>Mr,fromRabbitMQ:()=>Or,fromRaf:()=>Re,fromRedisStream:()=>hr,fromSSE:()=>or,fromSqlite:()=>Ur,fromSqliteCursor:()=>_r,fromStatsD:()=>lr,fromSyslog:()=>ur,fromTimer:()=>G,fromWebSocket:()=>Qn,fromWebSocketReconnect:()=>cr,fromWebhook:()=>Xn,globToRegExp:()=>Me,interval:()=>Kn,jsonCodec:()=>ft,jsonCodecFor:()=>ut,keepalive:()=>Qe,kvStorage:()=>gt,last:()=>un,linear:()=>he,lru:()=>fe,makeHttpError:()=>nt,map:()=>U,matchesAnyPattern:()=>Se,matchesCron:()=>ye,memoryAppendLog:()=>yt,memoryBackend:()=>pt,memoryKv:()=>kt,memorySnapshot:()=>bt,merge:()=>X,mergeMap:()=>Sn,mergeReactiveLogs:()=>nn,nameToSignal:()=>V,ndjsonRows:()=>wr,never:()=>Pe,nodeSignal:()=>Ge,of:()=>Ce,onFirstData:()=>gn,pairwise:()=>kn,parseCron:()=>be,parsePrometheusText:()=>br,parseSSEStream:()=>tr,parseStatsD:()=>mr,parseSyslog:()=>pr,pausable:()=>Un,pubsub:()=>wt,race:()=>wn,rateLimiter:()=>se,reactiveCounter:()=>Xe,reactiveIndex:()=>tt,reactiveList:()=>st,reactiveLog:()=>en,reactiveMap:()=>Jr,reactiveSink:()=>Jn,reduce:()=>sn,repeat:()=>Dn,replay:()=>_e,rescue:()=>_n,resolveBackoffPreset:()=>Ee,retry:()=>Z,sample:()=>In,scan:()=>on,serializeError:()=>P,share:()=>Ue,shareReplay:()=>Je,signalToName:()=>I,singleFromAny:()=>it,singleNodeFromAny:()=>at,skip:()=>cn,snapshotStorage:()=>lt,sortJsonValue:()=>ct,stableJsonString:()=>dt,stratify:()=>xt,switchMap:()=>En,take:()=>an,takeUntil:()=>fn,takeWhile:()=>dn,tap:()=>mn,tapFirst:()=>bn,throttle:()=>Bn,throttleTime:()=>qn,throwError:()=>Ae,timeout:()=>de,toArray:()=>De,toCSV:()=>Lr,toClickHouse:()=>jr,toFile:()=>Ir,toHTTP:()=>Zn,toKafka:()=>kr,toLoki:()=>Ar,toMongo:()=>Pr,toNATS:()=>Wr,toObservable:()=>ge,toPostgres:()=>Vr,toPulsar:()=>Sr,toRabbitMQ:()=>Br,toReadableStream:()=>rr,toRedisStream:()=>vr,toS3:()=>Cr,toSSE:()=>er,toSSEBytes:()=>nr,toSqlite:()=>$r,toTempo:()=>zr,toWebSocket:()=>ar,tokenBucket:()=>te,valve:()=>$n,verifiable:()=>Qr,window:()=>zn,windowCount:()=>Vn,windowTime:()=>An,withBreaker:()=>re,withLatestFrom:()=>vn,withMaxAttempts:()=>we,withStatus:()=>ie,workerBridge:()=>pe,workerSelf:()=>le,zip:()=>xn});function fe(){let e=new Map,t=null,n=null;function p(r){r.prev?r.prev.next=r.next:t=r.next,r.next?r.next.prev=r.prev:n=r.prev,r.prev=null,r.next=null}function l(r){r.next=t,r.prev=null,t&&(t.prev=r),t=r,n===null&&(n=r)}return{insert(r){if(e.has(r)){this.touch(r);return}let f={key:r,prev:null,next:null};e.set(r,f),l(f)},touch(r){let f=e.get(r);f&&(p(f),l(f))},delete(r){let f=e.get(r);f&&(p(f),e.delete(r))},evict(r){let f=[];for(let v=0;v<r&&n!==null;v++){let N=n;f.push(N.key),p(N),e.delete(N.key)}return f},size(){return e.size}}}function ue(e){return e!=null&&typeof e.then=="function"}function C(e){ue(e)&&e.catch(()=>{})}function Tt(e,t){let n=new Map,p=t?.maxSize??0,l=p>0?t?.eviction??fe():null,r=t?.writeThrough??!1;function f(o,u,m){for(let g=0;g<m;g++)try{C(e[g].save(o,u))}catch{}}function v(o,u,m=0){for(let g=m;g<e.length;g++){let w;try{w=e[g].load(o)}catch{continue}if(ue(w)){let T=g;w.then(M=>{M!==void 0?(u.down([[h,M]]),f(o,M,T)):v(o,u,T+1)},()=>{v(o,u,T+1)});return}if(w!==void 0){u.down([[h,w]]),f(o,w,g);return}}}function N(){if(!(!l||p<=0))for(;l.size()>=p;){let o=l.evict(1);if(o.length===0)break;for(let u of o){let m=n.get(u);if(m){let g=m.cache;if(m.status!=="sentinel"&&e.length>0){let w=e.length-1;try{C(e[w].save(u,g))}catch{}for(let T=0;T<w;T++)try{let M=e[T].delete;M&&C(M.call(e[T],u))}catch{}}m.down([[S]])}n.delete(u)}}}return{load(o){let u=n.get(o);if(u)return l?.touch(o),u;l&&p>0&&l.size()>=p&&N();let m=O(void 0);return n.set(o,m),l?.insert(o),v(o,m),m},save(o,u){if(r)for(let g of e)try{C(g.save(o,u))}catch{}else if(e[0])try{C(e[0].save(o,u))}catch{}let m=n.get(o);if(m)m.down([[h,u]]),l?.touch(o);else{l&&p>0&&l.size()>=p&&N();let g=O(u);n.set(o,g),l?.insert(o)}},invalidate(o){let u=n.get(o);u&&v(o,u)},delete(o){l?.delete(o);let u=n.get(o);u&&u.down([[S]]),n.delete(o);for(let m of e)try{let g=m.delete;g&&C(g.call(m,o))}catch{}},has(o){return n.has(o)},get size(){return n.size}}}var _=class{_version=0;_topics=new Set;get version(){return this._version}get topicCount(){return this._topics.size}hasTopic(t){return this._topics.has(t)}topicNames(){return this._topics.values()}createTopic(t){return this._topics.has(t)?!1:(this._topics.add(t),this._version+=1,!0)}removeTopic(t){let n=this._topics.delete(t);return n&&(this._version+=1),n}};function wt(e={}){let{backend:t}=e,n=t??new _,p=new Map;function l(r){let f=p.get(r);return f===void 0&&(f=j({describeKind:"state"}),p.set(r,f),n.createTopic(r)),f}return{topic(r){return l(r)},publish(r,f){l(r).emit(f)},publishMany(r){B(()=>{for(let[f,v]of r)l(f).emit(v)})},removeTopic(r){let f=p.get(r);return f===void 0?!1:(p.delete(r),n.removeTopic(r),f.down([[S]]),!0)},has(r){return n.hasTopic(r)},get size(){return n.topicCount},topicNames(){return n.topicNames()}}}var Et=new Map([[$,"INVALIDATE"],[F,"PAUSE"],[H,"RESUME"],[S,"TEARDOWN"],[q,"COMPLETE"],[W,"ERROR"]]),Nt=new Map([["INVALIDATE",$],["PAUSE",F],["RESUME",H],["TEARDOWN",S],["COMPLETE",q],["ERROR",W]]);function I(e){let t=Et.get(e);return t||(Symbol.keyFor(e)??"UNKNOWN")}function V(e){let t=Nt.get(e);if(t)return t;if(e&&e!=="UNKNOWN")return Symbol.for(e)}function P(e){return e instanceof Error?{message:e.message,name:e.name,stack:e.stack}:{message:String(e),name:"Error"}}function A(e){let t=new Error(e.message);return t.name=e.name,e.stack&&(t.stack=e.stack),t}function L(e){if(typeof MessagePort<"u"&&e instanceof MessagePort)return{post(t,n){e.postMessage(t,n??[])},listen(t){let n=p=>t(p.data);return e.addEventListener("message",n),e.start(),()=>e.removeEventListener("message",n)},terminate(){e.close()}};if(typeof SharedWorker<"u"&&e instanceof SharedWorker)return L(e.port);if(typeof Worker<"u"&&e instanceof Worker)return{post(t,n){e.postMessage(t,n??[])},listen(t){let n=p=>t(p.data);return e.addEventListener("message",n),()=>e.removeEventListener("message",n)},terminate(){e.terminate()}};if(typeof BroadcastChannel<"u"&&e instanceof BroadcastChannel)return{post(t,n){n&&n.length>0&&console.warn("[graphrefly] WorkerTransport: BroadcastChannel does not support Transferable objects. The transfer argument is ignored and objects will be cloned instead."),e.postMessage(t)},listen(t){let n=p=>t(p.data);return e.addEventListener("message",n),()=>e.removeEventListener("message",n)},terminate(){e.close()}};if(typeof ServiceWorker<"u"&&e instanceof ServiceWorker)return{post(t,n){e.postMessage(t,n??[])},listen(t){let n=p=>{p.source===e&&t(p.data)};return navigator.serviceWorker.addEventListener("message",n),()=>navigator.serviceWorker.removeEventListener("message",n)}};throw new Error("createTransport: unsupported target type. Expected Worker, SharedWorker, ServiceWorker, BroadcastChannel, or MessagePort.")}function Mt(e){return typeof e=="object"&&e!==null&&typeof e.post=="function"&&typeof e.listen=="function"}function pe(e,t){let n=Mt(e)?e:L(e),p=t.name??"workerBridge",l=Object.entries(t.expose??{}),r=t.import??[],f=t.transfer??{},v=O("connecting",{name:`${p}::meta::status`}),N=O(null,{name:`${p}::meta::error`}),o=new Map,u=new Map;for(let c of r){let a=O(void 0,{name:`${p}::${c}`});o.set(c,a)}let m;if(l.length>0){let c=l.map(([,d])=>d),a=j(c,(d,i)=>{let k={};for(let y=0;y<l.length;y++){let[R]=l[y],E=d[y];E!=null&&E.length>0&&(k[R]=E.at(-1))}Object.keys(k).length!==0&&i.emit(k)},{name:`${p}::aggregated`,partial:!0});m=D([a],d=>{let i=d[0];if(i==null||Object.keys(i).length===0)return;let k=[];for(let E of Object.keys(i)){let z=f[E];z&&k.push(...z(i[E]))}let y;for(let[E,z]of l)E in i&&z.v!=null&&(y==null&&(y={}),y[E]=z.v.version);let R={t:"b",u:i,...y?{v:y}:{}};try{n.post(R,k.length>0?k:void 0)}catch(E){N.down([[h,E instanceof Error?E:new Error(String(E))]])}}).subscribe(()=>{})}let g=!1,w=n.listen(c=>{if(g)return;let a=c;switch(a.t){case"r":{B(()=>{for(let[d,i]of Object.entries(a.stores)){let k=o.get(d);k&&k.down([[h,i]])}}),v.down([[h,"connected"]]);let s={};for(let[d,i]of l)s[d]=i.cache;n.post({t:"i",stores:s});break}case"v":{let s=o.get(a.s);s&&s.down([[h,a.d]]);break}case"b":{B(()=>{for(let[s,d]of Object.entries(a.u)){let i=a.v?.[s];if(i!=null){let y=u.get(s);if(y!=null&&i<=y)continue;u.set(s,i)}let k=o.get(s);k&&k.down([[h,d]])}});break}case"e":{let s=o.get(a.s);s&&s.down([[W,A(a.err)]]);break}case"s":{let s=V(a.sig);if(!s)break;let d=a.s==="*"?[...o.values()]:o.has(a.s)?[o.get(a.s)]:[];for(let i of d)i.down(a.d===void 0?[[s]]:[[s,a.d]]);break}}}),T=[];for(let[c,a]of l){let s=a.subscribe((d=>{if(!g)for(let i of d){let k=i[0];k!==h&&(K.isLocalOnly(k)||(k===W?n.post({t:"e",s:c,err:P(i[1])}):n.post({t:"s",s:c,sig:I(k),d:i.length>1?i[1]:void 0})))}}));T.push(s)}let M;if(t.timeoutMs!=null&&t.timeoutMs>0){let c=G(t.timeoutMs),a=J(v,d=>d==="connected");M=Q(X(U(c,()=>"timeout"),U(a,()=>"ready"))).subscribe(d=>{for(let i of d)i[0]===h&&i[1]==="timeout"&&(N.down([[h,new Error("Worker bridge handshake timeout")]]),x())})}function x(){if(!g){g=!0,M?.(),n.post({t:"s",s:"*",sig:I(S)}),m&&m();for(let c of T)c();T.length=0,w(),v.down([[h,"closed"]]),u.clear(),o.clear()}}let b={meta:{status:v,error:N},destroy:x};for(let[c,a]of o)b[c]=a;return b}function St(e){return typeof e=="object"&&e!==null&&typeof e.post=="function"&&typeof e.listen=="function"}function le(e,t){let n=St(e)?e:L(e),p=t.import??[],l=t.transfer??{},r=new Map,f=new Map,v={};for(let x of p){let b=O(void 0,{name:`worker::${x}`});r.set(x,b),v[x]=b}let N=t.expose(v),o=Object.entries(N),u,m=!1;if(o.length>0){let x=o.map(([,a])=>a),b=j(x,(a,s)=>{let d={};for(let i=0;i<o.length;i++){let[k]=o[i],y=a[i];y!=null&&y.length>0&&(d[k]=y.at(-1))}Object.keys(d).length!==0&&s.emit(d)},{name:"workerSelf::aggregated",partial:!0});u=D([b],a=>{if(m)return;let s=a[0];if(s==null||Object.keys(s).length===0)return;let d=[];for(let y of Object.keys(s)){let R=l[y];R&&d.push(...R(s[y]))}let i;for(let[y,R]of o)y in s&&R.v!=null&&(i==null&&(i={}),i[y]=R.v.version);let k={t:"b",u:s,...i?{v:i}:{}};try{n.post(k,d.length>0?d:void 0)}catch{}}).subscribe(()=>{})}let g=[];for(let[x,b]of o){let c=b.subscribe((a=>{if(!m)for(let s of a){let d=s[0];d!==h&&(K.isLocalOnly(d)||(d===W?n.post({t:"e",s:x,err:P(s[1])}):n.post({t:"s",s:x,sig:I(d),d:s.length>1?s[1]:void 0})))}}));g.push(c)}let w=n.listen(x=>{if(m)return;let b=x;switch(b.t){case"i":{B(()=>{for(let[c,a]of Object.entries(b.stores)){let s=r.get(c);s&&s.down([[h,a]])}});break}case"v":{let c=r.get(b.s);c&&c.down([[h,b.d]]);break}case"b":{B(()=>{for(let[c,a]of Object.entries(b.u)){let s=b.v?.[c];if(s!=null){let i=f.get(c);if(i!=null&&s<=i)continue;f.set(c,s)}let d=r.get(c);d&&d.down([[h,a]])}});break}case"e":{let c=r.get(b.s);c&&c.down([[W,A(b.err)]]);break}case"s":{let c=V(b.sig);if(!c)break;if(c===S&&b.s==="*"){M();return}let a=b.s==="*"?[...r.values()]:r.has(b.s)?[r.get(b.s)]:[];for(let s of a)s.down(b.d===void 0?[[c]]:[[c,b.d]]);break}}}),T={};for(let[x,b]of o)T[x]=b.cache;n.post({t:"r",stores:T});function M(){if(!m){m=!0,u&&u();for(let x of g)x();g.length=0,w(),n.terminate?.(),f.clear(),r.clear()}}return{destroy:M}}export{fe as a,Tt as b,_ as c,wt as d,I as e,V as f,P as g,A as h,L as i,pe as j,le as k,Rt as l};
|
package/dist/chunk-GDDPCDLG.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as M,c as re,d as se}from"./chunk-FJ6IEMOS.js";import{c as ae}from"./chunk-O32GJOUJ.js";import{j as ne}from"./chunk-B4L5X2QO.js";import{b as J}from"./chunk-KUVDFOJH.js";import{C as z}from"./chunk-MQZWA3DF.js";import{D as ee,E as te,G as j,m as Y,p as R,t as D}from"./chunk-LYCLF26R.js";import{b as X}from"./chunk-CK2E7BTU.js";import{b as ge}from"./chunk-QYADASLV.js";var fe={};ge(fe,{CqrsGraph:()=>G,cqrs:()=>ve,cqrsEventKeyOf:()=>ue,dispatchKeyOf:()=>pe,sagaInvocationKeyOf:()=>he});var x=class extends Error{constructor(e,n){super(e,n),this.name=this.constructor.name}},B=class extends x{constructor(n,t){super(`Duplicate ${n} registration: "${t}"`);this.kind=n;this.registrationName=t}},N=class extends x{constructor(n,t,r){super(`Command "${n}" emitted undeclared event "${t}". Declared emits: [${r.join(", ")}]`);this.commandName=n;this.eventName=t;this.declaredEmits=r}},K=class extends x{constructor(n,t,r){super(`Optimistic concurrency conflict on aggregate "${n}": expected version ${t}, got ${r}`);this.aggregateId=n;this.expected=t;this.actual=r}},H=class extends x{constructor(n){super(`Unknown command: "${n}". Register with command() first.`);this.commandName=n}},O=class extends x{constructor(n,t){super(`Command handler "${n}" threw: ${t instanceof Error?t.message:String(t)}`,{cause:t});this.commandName=n}};var P=class extends x{constructor(n,t){super(`Projection "${n}" rebuild failed: ${t instanceof Error?t.message:String(t)}`,{cause:t});this.projectionName=n}};var ce=D((a,e)=>{a("write"),a("signal"),e("observe")}),le=D((a,e)=>{a("observe"),a("signal"),e("write")}),oe=D((a,e)=>{a("observe"),a("signal"),e("write")});function $(a,e){return ae("cqrs",a,e)}function Z(a){if(a===null||typeof a!="object"||Object.isFrozen(a))return a;for(let e of Object.keys(a))Z(a[e]);return Object.freeze(a)}var ue=a=>`${a.type}::${a.aggregateId??"__default__"}`,pe=a=>a.commandName,he=a=>a.eventType,G=class extends ne{_eventLogs=new Map;_eventLogsByAggregate=new Map;_aggregateVersions=new Map;_aggregateLru=new Map;_commandRegs=new Map;_projections=new Set;_sagas=new Set;_keepaliveDisposers=[];_seq=0;_retainedLimit;_freezeCommandPayload;_freezeEventPayload;_maxAggregates;_dispatchSeqCursor;dispatches;audit;aggregateEvictions;constructor(e,n={}){super(e,n.graph),this._retainedLimit=n.retainedLimit??1024,this._freezeCommandPayload=n.freezeCommandPayload??!0,this._freezeEventPayload=n.freezeEventPayload??!0,this._maxAggregates=n.maxAggregates??1e4,this.dispatches=M({name:"dispatches",retainedLimit:this._retainedLimit,graph:this}),this.audit=this.dispatches,this.aggregateEvictions=M({name:"aggregateEvictions",retainedLimit:this._retainedLimit,graph:this}),this._dispatchSeqCursor=re(this,"dispatch_seq",0)}aggregateVersion(e,n){return this._aggregateVersions.get(`${e}::${n}`)??0}_touchAggregate(e){this._aggregateLru.delete(e),this._aggregateLru.set(e,!0)}_enforceAggregateLru(){for(;this._aggregateLru.size>this._maxAggregates;){let e=this._aggregateLru.keys().next();if(e.done)break;let n=e.value;this._aggregateLru.delete(n);let t=n.indexOf("::");if(t<0)continue;let r=n.slice(0,t),s=n.slice(t+2),o=this._aggregateVersions.get(n)??0;this._aggregateVersions.delete(n);let i=this._eventLogsByAggregate.get(r);i&&(i.delete(s),i.size===0&&this._eventLogsByAggregate.delete(r)),this.aggregateEvictions.append({aggregateId:s,type:r,lastVersion:o,t_ns:R()})}}destroy(){for(let e of this._keepaliveDisposers)e();this._keepaliveDisposers.length=0,super.destroy()}_attachedEventTiers=[];_attachedTierDisposers=new Map;attachEventStorage(e){this._attachedEventTiers.push(e);for(let[n,t]of this._eventLogs){let r=t.log.attachStorage(e),s=this._attachedTierDisposers.get(n);s||(s=[],this._attachedTierDisposers.set(n,s)),s.push(r)}for(let[n,t]of this._eventLogsByAggregate)for(let[r,s]of t){let o=`${n}::${r}`,i=s.log.attachStorage(e),c=this._attachedTierDisposers.get(o);c||(c=[],this._attachedTierDisposers.set(o,c)),c.push(i)}return()=>{let n=this._attachedEventTiers.indexOf(e);n>=0&&this._attachedEventTiers.splice(n,1)}}_autoWireStreamStorage(e,n){if(this._attachedEventTiers.length===0)return;let t=this._attachedTierDisposers.get(e);t||(t=[],this._attachedTierDisposers.set(e,t));for(let r of this._attachedEventTiers)t.push(n.attachStorage(r))}_bumpDispatchSeq(){let n=(this._dispatchSeqCursor.cache??0)+1;return this._dispatchSeqCursor.emit(n),n}event(e,n){if(n!==void 0)return this._ensureAggregateStream(e,n).node;let t=this._eventLogs.get(e);if(t)return t.node;let r=J([],{name:e,versioning:0,maxSize:this._retainedLimit});r.withLatest();let s=r.entries,o=j([s],([i])=>i,{name:e,describeKind:"state",meta:$("event",{event_name:e}),guard:oe,initial:s.cache});return this.add(o,{name:e}),this._keepaliveDisposers.push(z(o)),this._eventLogs.set(e,{log:r,node:o}),this._autoWireStreamStorage(e,r),o}_ensureAggregateStream(e,n){this._eventLogs.has(e)||this.event(e);let t=this._eventLogsByAggregate.get(e);t||(t=new Map,this._eventLogsByAggregate.set(e,t));let r=`${e}::${n}`;this._touchAggregate(r);let s=t.get(n);if(s)return s;let o=`${e}_${n.replace(/[^a-zA-Z0-9_-]/g,"_")}`,i=J([],{name:o,versioning:0,maxSize:this._retainedLimit});i.withLatest();let c=i.entries,h=j([c],([p])=>p,{name:o,describeKind:"state",meta:$("event_aggregate",{event_name:e,aggregate_id:n}),guard:oe,initial:c.cache}),l=o,m=0;for(;this.nameOf(this.resolveOptional(l)??h)===l&&(m+=1,l=`${o}_${m}`,this.resolveOptional(l)!==void 0););try{this.add(h,{name:l})}catch{}this._keepaliveDisposers.push(z(h));let u={log:i,node:h};return t.set(n,u),this._autoWireStreamStorage(`${e}::${n}`,i),this._enforceAggregateLru(),u}resolveOptional(e){try{return this.resolve(e)}catch{return}}_appendEvent(e,n,t){let r=this._eventLogs.get(e);if(r||(this.event(e),r=this._eventLogs.get(e)),r.node.status==="completed"||r.node.status==="errored")throw new Error(`Cannot dispatch to terminated event stream "${e}" (status: ${r.node.status}).`);let s,o;if(t?.aggregateId!==void 0){let l=`${e}::${t.aggregateId}`;s=(this._aggregateVersions.get(l)??0)+1,this._aggregateVersions.set(l,s),o=this._ensureAggregateStream(e,t.aggregateId)}let i=r.log.entries.v,c=this._freezeEventPayload?Z(n):n,h={type:e,payload:c,timestampNs:R(),seq:++this._seq,...t?.aggregateId!==void 0?{aggregateId:t.aggregateId}:{},...s!==void 0?{aggregateVersion:s}:{},...t?.correlationId!==void 0?{correlationId:t.correlationId}:{},...t?.causationId!==void 0?{causationId:t.causationId}:{},...t?.metadata!==void 0?{metadata:Object.freeze({...t.metadata})}:{},...t?.handlerVersion!==void 0?{handlerVersion:t.handlerVersion}:{},...i!=null?{v0:{id:i.id,version:i.version}}:{}};return r.log.append(h),o&&o.log.append(h),h}command(e,n){if(this._commandRegs.has(e))throw new B("command",e);let t=typeof n=="function"?{handler:n}:n,r=te(void 0,{name:e,describeKind:"state",meta:{...$("command",{command_name:e}),error:null},guard:ce});if(this.add(r,{name:e}),this._commandRegs.set(e,{handler:t.handler,...t.emits!==void 0?{emits:t.emits}:{},...t.handlerVersion!==void 0?{handlerVersion:t.handlerVersion}:{}}),t.emits)for(let s of t.emits)this._eventLogs.has(s)||this.event(s);return r}dispatch(e,n,t){let r=this._commandRegs.get(e);if(!r)throw new H(e);if(t?.aggregateId!==void 0&&t.expectedAggregateVersion!==void 0&&r.emits!==void 0){let u=0;for(let p of r.emits){let _=this._aggregateVersions.get(`${p}::${t.aggregateId}`);_!==void 0&&_>u&&(u=_)}if(u!==t.expectedAggregateVersion)throw new K(t.aggregateId,t.expectedAggregateVersion,u)}let s=this.resolve(e),o=this._freezeCommandPayload?Z(n):n,i=[],c=R(),h=0,l,m=!1;try{Y(()=>{h=this._bumpDispatchSeq(),s.emit(o,{internal:!0});try{r.handler(o,{emit:(u,p)=>{if(r.emits!==void 0&&!r.emits.includes(u))throw new N(e,u,r.emits);i.push(u),this._appendEvent(u,p,{...t?.aggregateId!==void 0?{aggregateId:t.aggregateId}:{},...t?.correlationId!==void 0?{correlationId:t.correlationId}:{},...t?.causationId!==void 0?{causationId:t.causationId}:{},...t?.metadata!==void 0?{metadata:Object.freeze({...t.metadata})}:{},...r.handlerVersion!==void 0?{handlerVersion:r.handlerVersion}:{}})}}),s.meta.error.emit(null,{internal:!0}),this.dispatches.append({commandName:e,payload:o,status:"success",emittedEvents:[...i],t_ns:c,seq:h,...r.handlerVersion!==void 0?{handlerVersion:r.handlerVersion}:{}})}catch(u){throw l=u,m=!0,u}})}catch(u){if(m){s.meta.error.emit(l,{internal:!0});let p=l instanceof Error?l.name:typeof l,_=l instanceof O?l:new O(e,l);this.dispatches.append({commandName:e,payload:o,status:"failed",error:_,errorType:p,emittedEvents:[...i],t_ns:c,seq:h,...r.handlerVersion!==void 0?{handlerVersion:r.handlerVersion}:{}})}throw m?l:u}}projection(e){let{name:n,events:t,reducer:r,initial:s}=e,o=e.mode??"scan",i=e.freezeInputs??!0,c=e.snapshot,h=t.map(d=>(this._eventLogs.has(d)||this.event(d),this._eventLogs.get(d).node));function l(d){d.sort((g,v)=>g.timestampNs-v.timestampNs||g.seq-v.seq||(g.aggregateId??"").localeCompare(v.aggregateId??""))}function m(d){let g=[];for(let v of d)g.push(...v);return l(g),g}let u=h.map(d=>d.cache??[]),p=m(u),_=i?Object.freeze(p):p,C=0,y=s;o==="scan"&&p.length>0&&(y=r(s,_),C=p.length);let q=o==="replay"?r(s,_):y,V=c?.saveDebounceMs??1e3,A=c?.saveEvery??1e3,E,L=0;function U(d){if(c?.save){if(L+=1,L>=A){L=0,E!==void 0&&(clearTimeout(E),E=void 0);let g=c.save(d);g instanceof Promise&&g.catch(()=>{});return}E!==void 0&&clearTimeout(E),E=setTimeout(()=>{E=void 0,L=0;let g=c.save(d);g instanceof Promise&&g.catch(()=>{})},V)}}let S=j(h,d=>{let g=m(d),v;if(o==="replay"){let w=i?Object.freeze(g):g;v=r(s,w)}else{let w=g.slice(C);C=g.length;let f=i?Object.freeze(w):w;v=r(y,f),y=v}return U(v),v},{name:n,describeKind:"derived",meta:$("projection",{projection_name:n,source_events:t}),guard:le,initial:q});return this.add(S,{name:n}),this._keepaliveDisposers.push(z(S)),this._keepaliveDisposers.push(()=>{E!==void 0&&(clearTimeout(E),E=void 0)}),this._projections.add(n),{node:S,rebuild:async d=>{try{let g=d?.pageSize??1e3,v=d?.fromTier??this._attachedEventTiers[0]?.[0],w=m(h.map(T=>T.cache??[])).length,f=s;if(c?.load){let T=await c.load();T!==void 0&&(f=T)}if(!v||!v.loadEntries){let T=m(h.map(I=>I.cache??[])),b=i?Object.freeze(T):T;f=r(f,b)}else{let T=new Set(t),b,I=!1;for(;!I;){let F=await v.loadEntries({cursor:b,pageSize:g}),W=[...F.entries].filter(de=>T.has(de.type));l(W);let ie=i?Object.freeze(W):W;f=r(f,ie),b=F.cursor,I=!b||F.entries.length===0}}if(o==="scan"){let T=m(h.map(I=>I.cache??[])),b=T.slice(w);if(b.length>0){let I=i?Object.freeze(b):b;f=r(f,I)}y=f,C=T.length}return S.emit(f,{internal:!0}),f}catch(g){throw new P(n,g)}},reset:async()=>{try{let d=s;if(c?.load){let f=await c.load();f!==void 0&&(d=f)}let g=m(h.map(f=>f.cache??[])),v=i?Object.freeze(g):g,w=r(d,v);return o==="scan"&&(y=w,C=g.length),S.emit(w,{internal:!0}),w}catch(d){throw new P(n,d)}}}}saga(e,n,t,r={}){let s=n.map(p=>(this._eventLogs.has(p)||this.event(p),this._eventLogs.get(p).node)),o=se(this,`${e}_cursor`,n,0),i=M({name:`${e}_invocations`,retainedLimit:this._retainedLimit,graph:this}),c=r.aggregateId,h=r.errorPolicy??"advance",l=new Map;for(let p of n){let _=o[p];l.set(p,_.cache??0);let C=_.subscribe(y=>{for(let q of y)q[0]===X&&l.set(p,q[1])});this._keepaliveDisposers.push(C)}let m={},u=ee(s,(p,_)=>{let C=m.n.meta.error;for(let y=0;y<p.length;y++){let q=p[y];if(q==null||q.length===0)continue;let V=q.at(-1);if(!V)continue;let A=n[y],E=o[A],L=l.get(A)??0;if(V.length>L){let U=V.slice(L),S=L;for(let Q of U){let k=Q;if(c!==void 0&&k.aggregateId!==c){S+=1;continue}try{t(k),C.emit(null,{internal:!0}),i.append({eventType:A,status:"success",aggregateId:k.aggregateId,event:k,t_ns:R(),...r.handlerVersion!==void 0?{handlerVersion:r.handlerVersion}:{}}),S+=1}catch(d){if(C.emit(d,{internal:!0}),i.append({eventType:A,status:"failed",error:d,errorType:d instanceof Error?d.name:typeof d,aggregateId:k.aggregateId,event:k,t_ns:R(),...r.handlerVersion!==void 0?{handlerVersion:r.handlerVersion}:{}}),h==="hold")break;S+=1}}E.emit(S)}}},{name:e,describeKind:"effect",meta:{...$("saga",{saga_name:e,source_events:n}),error:null}});return m.n=u,this.add(u,{name:e}),this._keepaliveDisposers.push(z(u)),this._sagas.add(e),{node:u,invocations:i,audit:i,cursors:o}}};function ve(a,e){return new G(a,e)}export{ue as a,pe as b,he as c,G as d,ve as e,fe as f};
|
package/dist/chunk-GFOT6UBB.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as L,b as _}from"./chunk-FJ6IEMOS.js";import{c as z}from"./chunk-O32GJOUJ.js";import{j as F}from"./chunk-B4L5X2QO.js";import{D as j,E as G,G as D,m as E,p as B}from"./chunk-LYCLF26R.js";import{b as P,d as S,i as I,j as K}from"./chunk-CK2E7BTU.js";import{b as te}from"./chunk-QYADASLV.js";var ie={};te(ie,{PipelineGraph:()=>x,decisionKeyOf:()=>$,pipelineGraph:()=>q});function N(y,t){return z("orchestration",y,t)}var $=y=>y.action,x=class extends F{constructor(t,s){super(t,s)}task(t,s,e={}){let a=(e.deps??[]).map(c=>this._resolveStep(c)),p=D(a,s,{name:t,describeKind:"derived",meta:N("task",e.meta)});return this.add(p,{name:t}),p}classify(t,s,e,a={}){let p=this._resolveStep(s),c=D([p],([d])=>{try{return{tag:e(d),value:d}}catch(f){return{tag:"error",value:d,error:f}}},{name:t,describeKind:"derived",meta:N("classify",a.meta)});return this.add(c,{name:t}),c}combine(t,s,e={}){let a=Object.keys(s),p=a.map(d=>this._resolveStep(s[d])),c=D(p,d=>{let f={};for(let i=0;i<a.length;i++)f[a[i]]=d[i];return f},{name:t,describeKind:"derived",meta:N("combine",e.meta)});return this.add(c,{name:t}),c}gate(t,s,e={}){let a=e.maxPending??1e3;if(a<1&&a!==Number.POSITIVE_INFINITY)throw new RangeError("gate: maxPending must be >= 1");let p=e.startOpen??!1;typeof s!="string"&&this.nameOf(s)===void 0&&this.add(s,{name:`${t}/source`});let c=this._resolveStep(s),d=new F(`${t}_state`),f=G([],{name:"pending",equals:()=>!1}),i=G(p,{name:"isOpen"}),R=D([f],([n])=>n.length,{name:"count"}),h=G(0,{name:"droppedCount"}),u=L({name:"decisions",retainedLimit:1024,graph:d});d.add(f,{name:"pending"}),d.add(i,{name:"isOpen"}),d.add(R,{name:"count"}),d.add(h,{name:"droppedCount"}),this.mount(`${t}_state`,d);let l=[],v=!1,k=!1,O=p,W=i.subscribe(n=>{for(let o of n)o[0]===P&&(O=o[1])});this.addDisposer(W);function A(){f.emit([...l])}function C(n,o,r){u.append({action:n,t_ns:B(),...o!==void 0?{items:o,count:o.length}:{},...r!==void 0?{unflushed:r}:{},...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}})}function M(n){if(l.push(n),l.length>a){let o=l.shift();h.emit(h.cache+1),C("drop",[o])}A()}function w(n){let o=l.splice(0,n);return A(),o}let b=j([c],(n,o,r)=>{let T=r.terminalDeps[0];if(T!==void 0){v=!0;let g=l.length;l=[],A(),C("teardown",void 0,g),o.down(T===!0?[[I]]:[[K,T]]);return}let m=n[0];if(m==null||m.length===0){o.down([[S]]);return}for(let g of m)O?o.emit(g):(M(g),o.down([[S]]))},{name:t,describeKind:"derived",meta:N("gate",e.meta)});if(this.add(b,{name:t}),e.approver!=null){e.approver.cache&&(i.emit(!0),O=!0,e.onceOnly&&(k=!0));let o=e.approver.subscribe(r=>{for(let T of r){if(T[0]!==P)continue;let m=!!T[1];if(m&&!O){if(e.onceOnly){if(k)continue;k=!0}E(()=>{i.emit(!0);let g=w(l.length);C("open",g);for(let oe of g){if(v)break;b.emit(oe)}})}else if(!m&&O){if(e.onceOnly&&k)continue;E(()=>{i.emit(!1),C("close")})}}});this.addDisposer(o)}let V=n=>{if(v)throw new Error(`gate: ${n}() called after gate was torn down`)},U=(n=1)=>{V("approve");let o=w(n);for(let r of o){if(v)break;b.emit(r)}},Y=(n=1)=>{V("reject"),w(n)},H=(n,o=1)=>{V("modify");let r=[...l],T=w(o);for(let m=0;m<T.length&&!v;m++)b.emit(n(T[m],m,r))},J=()=>{V("open"),i.emit(!0);let n=w(l.length);for(let o of n){if(v)break;b.emit(o)}},Q=()=>{V("close"),!(e.onceOnly&&k)&&i.emit(!1)},X=_(U,{audit:u,freeze:!1,onSuccess:(n,o,r)=>({action:"approve",count:n[0]??1,t_ns:r.t_ns,...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}}),onFailure:(n,o,r)=>({action:"drop",t_ns:r.t_ns,errorType:r.errorType,...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}})}),Z=_(Y,{audit:u,freeze:!1,onSuccess:(n,o,r)=>({action:"reject",count:n[0]??1,t_ns:r.t_ns,...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}}),onFailure:(n,o,r)=>({action:"drop",t_ns:r.t_ns,errorType:r.errorType,...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}})}),ee=_(H,{audit:u,freeze:!1,onSuccess:(n,o,r)=>({action:"modify",count:n[1]??1,t_ns:r.t_ns,...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}}),onFailure:(n,o,r)=>({action:"drop",t_ns:r.t_ns,errorType:r.errorType,...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}})}),ne=_(J,{audit:u,freeze:!1,onSuccess:(n,o,r)=>({action:"open",t_ns:r.t_ns,...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}}),onFailure:(n,o,r)=>({action:"drop",t_ns:r.t_ns,errorType:r.errorType,...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}})}),re=_(Q,{audit:u,freeze:!1,onSuccess:(n,o,r)=>({action:"close",t_ns:r.t_ns,...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}}),onFailure:(n,o,r)=>({action:"drop",t_ns:r.t_ns,errorType:r.errorType,...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}})});return this.addDisposer(R.subscribe(()=>{})),{node:b,pending:f,count:R,isOpen:i,droppedCount:h,decisions:u,audit:u,approve:X,reject:Z,modify:ee,open:ne,close:re}}approval(t,s,e,a={}){return this.gate(t,s,{...a,approver:e,maxPending:1})}catch(t,s,e,a={}){let p=this._resolveStep(s),c=a.on??"error",d=j([p],(f,i,R)=>{let h=R.terminalDeps[0];if(h!==void 0){let l=h===!0?{kind:"complete"}:{kind:"error",error:h};if(c==="terminal"||c===l.kind){i.emit(e(l,i));return}i.down(l.kind==="complete"?[[I]]:[[K,l.error]]);return}let u=f[0];if(u==null||u.length===0){i.down([[S]]);return}for(let l of u)i.emit(l)},{name:t,describeKind:"derived",completeWhenDepsComplete:a.completeWhenDepsComplete??!(c==="complete"||c==="terminal"),errorWhenDepsError:!(c==="error"||c==="terminal"),meta:N("catch",a.meta)});return this.add(d,{name:t}),d}_resolveStep(t){if(typeof t=="string")return this.resolve(t);if(this.nameOf(t)===void 0)throw new Error(`PipelineGraph "${this.name}": Node dep is not registered. Pass a string path or call graph.add(node) first.`);return t}};function q(y,t){return new x(y,t)}export{$ as a,x as b,q as c,ie as d};
|
package/dist/chunk-JJTF75VS.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as P}from"./chunk-4VVTGLXJ.js";import{m as y}from"./chunk-MQZWA3DF.js";import{D as N,F as w,G as W,o as k}from"./chunk-LYCLF26R.js";import{a as C,b as p,c as A,d as m,i as a,j as b}from"./chunk-CK2E7BTU.js";function c(d){return{describeKind:"derived",...d}}function B(d){return{describeKind:"derived",partial:!0,...d}}function Q(d,i,u){return N([d],(t,e)=>{let n=t[0];if(n==null||n.length===0){e.down([[m]]);return}for(let o of n)e.emit(i(o))},c(u))}function S(d,i,u){return N([d],(t,e)=>{let n=t[0];if(n==null||n.length===0){e.down([[m]]);return}let o=!1;for(let r of n)i(r)&&(e.emit(r),o=!0);o||e.down([[m]])},c(u))}function X(d,i,u,t){return N([d],(e,n,o)=>{"acc"in o.store||(o.store.acc=u);let r=e[0];if(r==null||r.length===0){n.down([[m]]);return}for(let s of r)o.store.acc=i(o.store.acc,s),n.emit(o.store.acc)},{...c(t),initial:u,resetOnTeardown:!0})}function Z(d,i,u,t){return N([d],(e,n,o)=>{if("acc"in o.store||(o.store.acc=u),o.terminalDeps[0]===!0){n.emit(o.store.acc),n.down([[a]]);return}let r=e[0];if(r==null||r.length===0){n.down([[m]]);return}for(let s of r)o.store.acc=i(o.store.acc,s)},{...c(t),completeWhenDepsComplete:!1})}function M(d,i,u){return i<=0?N([d],(t,e,n)=>{n.store.completed||(n.store.completed=!0,e.down([[a]]))},{...c(u),completeWhenDepsComplete:!1}):N([d],(t,e,n)=>{if("taken"in n.store||(n.store.taken=0),n.store.done){e.down([[m]]);return}if(n.terminalDeps[0]===!0){n.store.done=!0,e.down([[a]]);return}let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}for(let r of o)if(n.store.taken++,e.emit(r),n.store.taken>=i){n.store.done=!0,e.down([[a]]);return}},{...c(u),completeWhenDepsComplete:!1})}function V(d,i,u){return N([d],(t,e,n)=>{"skipped"in n.store||(n.store.skipped=0);let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}let r=!1;for(let s of o)n.store.skipped++,n.store.skipped<=i||(e.emit(s),r=!0);r||e.down([[m]])},c(u))}function $(d,i,u){return N([d],(t,e,n)=>{if(n.store.done){e.down([[m]]);return}let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}for(let r of o){if(!i(r)){n.store.done=!0,e.down([[a]]);return}e.emit(r)}},{...c(u),completeWhenDepsComplete:!1})}function ee(d,i,u){let t=u?.predicate??(o=>o[0]===p),{predicate:e,...n}=u??{};return w(o=>{let r=!1,s=d.subscribe(l=>{if(!r)for(let T of l){if(r)return;T[0]===p?o.emit(T[1]):(T[0]===a||T[0]===b)&&(r=!0,o.down([T]))}}),f=i.subscribe(l=>{if(!r)for(let T of l){if(r)return;if(t(T)){r=!0,o.down([[a]]);return}}});return()=>{s(),f()}},c(n))}function ne(d,i){return M(d,1,i)}function te(d,i){let{defaultValue:u,...t}=i??{},e=i!=null&&Object.hasOwn(i,"defaultValue");return N([d],(n,o,r)=>{if(r.terminalDeps[0]===!0){r.store.has?o.emit(r.store.latest):e&&o.emit(u),o.down([[a]]);return}let s=n[0];if(s==null||s.length===0){o.down([[m]]);return}r.store.latest=s.at(-1),r.store.has=!0},{...c(t),completeWhenDepsComplete:!1})}function oe(d,i,u){return M(S(d,i,u),1,u)}function re(d,i,u){return M(V(d,i,u),1,u)}function se(d,i,u){if(typeof i=="function")return N([d],(e,n)=>{let o=e[0];if(o==null||o.length===0){n.down([[m]]);return}for(let r of o)i(r),n.emit(r)},c(u));let t=i;return N([d],(e,n,o)=>{if(o.terminalDeps[0]!==void 0){o.terminalDeps[0]===!0?(t.complete?.(),n.down([[a]])):(t.error?.(o.terminalDeps[0]),n.down([[b,o.terminalDeps[0]]]));return}let r=e[0];if(r==null||r.length===0){n.down([[m]]);return}for(let s of r)t.data?.(s),n.emit(s)},{...c(u),completeWhenDepsComplete:!1})}function K(d,i,u){let t=u?.where??(n=>n!=null),e=!1;return N([d],(n,o)=>{let r=n[0];if(r==null||r.length===0){o.down([[m]]);return}for(let s of r)!e&&t(s)&&(e=!0,i(s)),o.emit(s)},c(u))}var ie=K;function ue(d,i=Object.is,u){return N([d],(t,e,n)=>{let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}let r=!1;for(let s of o)n.store.hasPrev&&i(n.store.prev,s)||(n.store.prev=s,n.store.hasPrev=!0,e.emit(s),r=!0);r||e.down([[m]])},c(u))}function fe(d,i){return N([d],(u,t,e)=>{let n=u[0];if(n==null||n.length===0){t.down([[m]]);return}let o=!1;for(let r of n)if(!e.store.hasPrev)e.store.prev=r,e.store.hasPrev=!0;else{let s=[e.store.prev,r];e.store.prev=r,t.emit(s),o=!0}o||t.down([[m]])},c(i))}function q(...d){let i=[...d];return W(i,u=>u,{...c(),equals:(u,t)=>{if(u.length!==t.length)return!1;for(let e=0;e<u.length;e++)if(!Object.is(u[e],t[e]))return!1;return!0}})}function de(d,i,u){return N([d,i],(t,e,n)=>{let o=t[0],r=t[1],s=r!=null&&r.length>0?r.at(-1):n.prevData[1];if(o!=null&&o.length>0){if(!(r!=null&&r.length>0)&&n.prevData[1]===void 0){e.down([[m]]);return}for(let f of o)e.emit([f,s])}else e.down([[m]])},B(u))}function le(...d){return d.length===0?w(i=>{i.down([[a]])},c()):w(i=>{let u=d.length,t=0,e=[];for(let n of d){let o=n.subscribe(r=>{for(let s of r)s[0]===p?i.emit(s[1]):s[0]===a?(t+=1,t>=u&&i.down([[a]])):s[0]===b&&i.down([s])});e.push(o)}return()=>{for(let n of e)n()}},c())}function ae(...d){let i=d.length;return i===0?w(u=>{u.emit([]),u.down([[a]])},c()):w(u=>{let t=Array.from({length:i},()=>[]),e=i;function n(){for(;t.every(r=>r.length>0);){let r=t.map(s=>s.shift());u.emit(r)}}let o=[];for(let r=0;r<i;r++){let s=r,f=d[r].subscribe(l=>{for(let T of l)T[0]===p?(t[s].push(T[1]),n()):T[0]===a?(e-=1,(e===0||t[s].length===0)&&u.down([[a]])):T[0]===b&&u.down([T])});o.push(f)}return()=>{for(let r of o)r()}},c())}function ce(d,i,u){return w(t=>{let e=0,n=[],o,r;return r=i.subscribe(s=>{for(let f of s)e===0?f[0]===p?n.push(f[1]):f[0]===b&&t.down([f]):f[0]===p?t.emit(f[1]):(f[0]===a||f[0]===b)&&t.down([f])}),o=d.subscribe(s=>{for(let f of s)if(e===0)if(f[0]===p)t.emit(f[1]);else if(f[0]===a){e=1;for(let l of n)t.emit(l);n.length=0}else f[0]===b&&t.down([f])}),()=>{o?.(),r?.()}},c(u))}function Te(...d){return d.length===0?w(i=>{i.down([[a]])},c()):d.length===1?N([d[0]],(i,u)=>{let t=i[0];if(t==null||t.length===0){u.down([[m]]);return}for(let e of t)u.emit(e)},c()):w(i=>{let u=null,t=[];for(let e=0;e<d.length;e++){let n=e,o=d[e].subscribe(r=>{for(let s of r){if(u!==null&&n!==u)return;s[0]===p?(u===null&&(u=n),i.emit(s[1])):(s[0]===a||s[0]===b)&&(u===null||n===u)&&i.down([s])}});t.push(o)}return()=>{for(let e of t)e()}},c())}function I(d,i,u){let t,e=!1,n=()=>{e||(e=!0,u())};return t=d.subscribe(o=>{let r=!1,s=!1;for(let f of o)f[0]!==C&&(f[0]===p?i.emit(f[1]):f[0]===a?r=!0:f[0]===b?(s=!0,i.down([f])):(f[0]===A||f[0]===m)&&i.down([f]));s?(t?.(),t=void 0,n()):r&&n()}),()=>{t?.(),t=void 0}}function pe(d,i,u){let t,e=!1;function n(){t?.(),t=void 0}return N([d],(o,r,s)=>{if(s.terminalDeps[0]!=null&&s.terminalDeps[0]!==!0){n();return}if(s.terminalDeps[0]===!0){e=!0,t||r.down([[a]]);return}let f=o[0];if(!(f==null||f.length===0))return n(),t=I(y(i(f[f.length-1])),r,()=>{n(),e&&r.down([[a]])}),{deactivate:()=>{n(),e=!1}}},{...c(u),completeWhenDepsComplete:!1})}function me(d,i,u){let t,e=!1;function n(){t?.(),t=void 0}return N([d],(o,r,s)=>{if(s.terminalDeps[0]!=null&&s.terminalDeps[0]!==!0){n();return}if(s.terminalDeps[0]===!0){e=!0,t||r.down([[a]]);return}let f=o[0];if(!(f==null||f.length===0))return t===void 0?t=I(y(i(f[0])),r,()=>{n(),e&&r.down([[a]])}):r.down([[m]]),{deactivate:()=>{n(),e=!1}}},{...c(u),completeWhenDepsComplete:!1})}function be(d,i,u){let{maxBuffer:t,...e}=u??{},n=[],o,r=!1,s;function f(){o?.(),o=void 0}function l(){if(!s||o!==void 0)return;if(n.length===0){r&&s.down([[a]]);return}let h=n.shift();o=I(y(i(h)),s,()=>{f(),l()})}function T(h){t&&t>0&&n.length>=t&&n.shift(),n.push(h),l()}return N([d],(h,O,x)=>{if(s=O,x.terminalDeps[0]!=null&&x.terminalDeps[0]!==!0){f(),n.length=0;return}if(x.terminalDeps[0]===!0){r=!0,l();return}let E=h[0];if(!(E==null||E.length===0)){for(let v of E)T(v);return{deactivate:()=>{f(),n.length=0,r=!1}}}},{...c(e),completeWhenDepsComplete:!1})}function _(d,i,u){let{concurrent:t,...e}=u??{},n=t!=null&&t>0?t:Number.POSITIVE_INFINITY,o=0,r=!1,s=new Set,f=[],l;function T(){r&&o===0&&f.length===0&&l&&l.down([[a]])}function h(v){if(!l)return;o++;let g;g=I(y(i(v)),l,()=>{g&&s.delete(g),o--,O(),T()}),s.add(g)}function O(){for(;f.length>0&&o<n;)h(f.shift())}function x(v){o<n?h(v):f.push(v)}function E(){for(let v of s)v();s.clear(),o=0,f.length=0}return N([d],(v,g,D)=>{if(l=g,D.terminalDeps[0]!=null&&D.terminalDeps[0]!==!0){E();return}if(D.terminalDeps[0]===!0){r=!0,T();return}let R=v[0];if(!(R==null||R.length===0)){for(let U of R)x(U);return{deactivate:()=>{E(),r=!1}}}},{...c(e),completeWhenDepsComplete:!1})}var we=_;function Ne(d,i,u){return w(t=>{let e=new Set;function n(){for(let r of e)clearTimeout(r);e.clear()}let o=d.subscribe(r=>{for(let s of r)if(s[0]===p){let f=setTimeout(()=>{e.delete(f),t.emit(s[1])},i);e.add(f)}else if(s[0]===a){let f=setTimeout(()=>{e.delete(f),t.down([[a]])},i);e.add(f)}else s[0]===b&&(n(),t.down([s]))});return()=>{o(),n()}},c(u))}function j(d,i,u){return w(t=>{let e,n;function o(){e!==void 0&&(clearTimeout(e),e=void 0)}let r=d.subscribe(s=>{for(let f of s)f[0]===p?(o(),n=f[1],e=setTimeout(()=>{e=void 0,t.emit(n)},i)):f[0]===a?(e!==void 0&&(o(),t.emit(n)),t.down([[a]])):f[0]===b&&(o(),t.down([f]))});return()=>{r(),o()}},c(u))}function F(d,i,u){let{leading:t,trailing:e,...n}=u??{},o=t!==!1,r=e===!0,s=i*1e6;return w(f=>{let l,T=-1/0,h,O=!1;function x(){l!==void 0&&(clearTimeout(l),l=void 0)}let E=d.subscribe(v=>{for(let g of v)if(g[0]===p){let D=g[1],R=k();if(o&&R-T>=s)T=R,f.emit(D),x(),r&&(l=setTimeout(()=>{l=void 0,O&&(T=k(),f.emit(h),O=!1)},i));else if(r&&(h=D,O=!0,l===void 0)){let U=(R-T)/1e6;l=setTimeout(()=>{l=void 0,O&&(T=k(),f.emit(h),O=!1)},Math.max(0,i-U))}}else(g[0]===a||g[0]===b)&&(x(),f.down([g]))});return()=>{E(),x()}},c(n))}function he(d,i,u){return w(t=>{let e,n=!1,o=!1,r=d.subscribe(f=>{if(!n)for(let l of f){if(n)return;l[0]===p?e={v:l[1]}:l[0]===b?(n=!0,t.down([l])):l[0]===a&&(o=!0,e=void 0)}}),s=i.subscribe(f=>{if(!n)for(let l of f){if(n)return;l[0]===p?e!==void 0&&!o&&t.emit(e.v):l[0]===b?(n=!0,t.down([l])):l[0]===a&&(n=!0,t.down([[a]]))}});return()=>{r(),s()}},c(u))}function ve(d,i,u){return w(t=>{let e,n,o=!1;function r(){e!==void 0&&(clearTimeout(e),e=void 0)}let s=d.subscribe(f=>{for(let l of f)l[0]===p?(n=l[1],o=!0,r(),e=setTimeout(()=>{e=void 0,o&&(o=!1,t.emit(n))},i)):(l[0]===a||l[0]===b)&&(r(),t.down([l]))});return()=>{s(),r()}},c(u))}function ge(d,i,u){let{with:t,...e}=u??{},n=t??new Error("timeout");return w(o=>{let r;function s(){clearTimeout(r),r=setTimeout(()=>{r=void 0,o.down([[b,n]])},i)}s();let f=d.subscribe(l=>{for(let T of l)T[0]===p?(s(),o.emit(T[1])):(T[0]===a||T[0]===b)&&(clearTimeout(r),o.down([T]))});return()=>{f(),clearTimeout(r)}},c(e))}function Oe(d,i,u){return w(t=>{let e=[],n=d.subscribe(r=>{for(let s of r)s[0]===p?e.push(s[1]):s[0]===a?(e.length>0&&t.emit([...e]),e.length=0,t.down([[a]])):s[0]===b&&t.down([s])}),o=i.subscribe(r=>{for(let s of r)s[0]===p?e.length>0&&(t.emit([...e]),e.length=0):s[0]===a?t.down([[a]]):s[0]===b&&t.down([s])});return()=>{n(),o(),e.length=0}},c(u))}function xe(d,i,u){if(i<=0)throw new RangeError("bufferCount expects count > 0");return w(t=>{let e=[],n=d.subscribe(o=>{for(let r of o)r[0]===p?(e.push(r[1]),e.length>=i&&t.emit(e.splice(0,e.length))):r[0]===a?(e.length>0&&t.emit([...e]),e.length=0,t.down([[a]])):r[0]===b&&t.down([r])});return()=>{n(),e.length=0}},c(u))}function Ee(d,i,u){if(i<=0)throw new RangeError("windowCount expects count > 0");return w(t=>{let e,n=0;function o(){let s=w(f=>(e=f.down.bind(f),()=>{e=void 0}),c());n=0,t.emit(s)}let r=d.subscribe(s=>{for(let f of s)f[0]===p?(e||o(),e?.([[p,f[1]]]),n+=1,n>=i&&(e?.([[a]]),e=void 0)):f[0]===a?(e?.([[a]]),e=void 0,t.down([[a]])):f[0]===b&&(e?.([f]),e=void 0,t.down([f]))});return()=>{r(),e?.([[a]]),e=void 0}},c(u))}function Re(d,i,u){return w(t=>{let e=[],n=setInterval(()=>{e.length>0&&(t.emit([...e]),e.length=0)},i),o=d.subscribe(r=>{for(let s of r)s[0]===p?e.push(s[1]):s[0]===a?(clearInterval(n),e.length>0&&t.emit([...e]),e.length=0,t.down([[a]])):s[0]===b&&(clearInterval(n),t.down([s]))});return()=>{o(),clearInterval(n),e.length=0}},c(u))}function De(d,i,u){return w(t=>{let e;function n(){e?.([[a]]),e=void 0}function o(){let f=w(l=>(e=l.down.bind(l),()=>{e=void 0}),c());t.emit(f)}o();let r=setInterval(()=>{n(),o()},i),s=d.subscribe(f=>{for(let l of f)l[0]===p?e?.([[p,l[1]]]):l[0]===a?(clearInterval(r),n(),t.down([[a]])):l[0]===b&&(clearInterval(r),e?.([l]),n(),t.down([l]))});return()=>{s(),clearInterval(r),n()}},c(u))}function ye(d,i,u){return w(t=>{let e;function n(){e?.([[a]]),e=void 0}function o(){let f=w(l=>(e=l.down.bind(l),()=>{e=void 0}),c());t.emit(f)}let r=d.subscribe(f=>{for(let l of f)l[0]===p?(e||o(),e?.([[p,l[1]]])):l[0]===a?(n(),t.down([[a]])):l[0]===b&&(e?.([l]),e=void 0,t.down([l]))}),s=i.subscribe(f=>{for(let l of f)l[0]===p&&(n(),o())});return()=>{r(),s(),n()}},c(u))}function ke(d,i){return w((u,t)=>{"n"in t.store||(t.store.n=0);let e=setInterval(()=>{u.emit(t.store.n),t.store.n=t.store.n+1},d);return()=>clearInterval(e)},c(i))}function Ie(d,i,u){if(i<=0)throw new RangeError("repeat expects count > 0");return w(t=>{let e=i,n,o=()=>{n?.(),n=d.subscribe(r=>{let s=!1,f=[];for(let l of r)l[0]===a?s=!0:f.push(l);f.length>0&&t.down(f),s&&(n?.(),n=void 0,e-=1,e>0?o():t.down([[a]]))})};return o(),()=>{n?.()}},c(u))}function Ue(d,i){return N([d],(u,t)=>{let e=u[0];if(e==null||e.length===0){t.down([[m]]);return}for(let n of e)t.emit(n)},c(i))}function L(d,i,u){return w(t=>{let e=d.subscribe(n=>{for(let o of n)if(o[0]===p)t.emit(o[1]);else if(o[0]===b)try{t.emit(i(o[1]))}catch(r){t.down([[b,r]])}else o[0]===a&&t.down([[a]])});return()=>{e()}},c(u))}function Me(d,i,u){return N([d,i],(t,e,n)=>{let o=t[1];if(!(o!=null&&o.length>0?o.at(-1):n.prevData[1])){e.down([[m]]);return}let s=t[0];if(s!=null&&s.length>0){for(let f of s)e.emit(f);return}if(o!=null&&o.length>0&&n.prevData[0]!==void 0){e.emit(n.prevData[0]);return}e.down([[m]])},B(u))}var Ce=q,Ae=j,We=F,Pe=L;export{Q as a,S as b,X as c,Z as d,M as e,V as f,$ as g,ee as h,ne as i,te as j,oe as k,re as l,se as m,K as n,ie as o,ue as p,fe as q,q as r,de as s,le as t,ae as u,ce as v,Te as w,pe as x,me as y,be as z,_ as A,we as B,Ne as C,j as D,F as E,he as F,ve as G,ge as H,Oe as I,xe as J,Ee as K,Re as L,De as M,ye as N,ke as O,Ie as P,Ue as Q,L as R,Me as S,Ce as T,Ae as U,We as V,Pe as W};
|
package/dist/chunk-K2WYIVHM.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as L,c as D}from"./chunk-FJ6IEMOS.js";import{c as Q}from"./chunk-O32GJOUJ.js";import{j as F}from"./chunk-B4L5X2QO.js";import{b as G}from"./chunk-KGKJCHEK.js";import{b as I}from"./chunk-TZQPPQEQ.js";import{b as M}from"./chunk-KUVDFOJH.js";import{C as v,m as C}from"./chunk-MQZWA3DF.js";import{D as x,G as P,m as _,p as m}from"./chunk-LYCLF26R.js";import{b as N,j as A}from"./chunk-CK2E7BTU.js";import{b as V}from"./chunk-QYADASLV.js";var ee={};V(ee,{JobFlowGraph:()=>w,JobQueueGraph:()=>y,jobEventKeyOf:()=>Y,jobFlow:()=>Z,jobQueue:()=>z});var X=256,H=1024;function W(i,e){if(!Number.isFinite(i)||!Number.isInteger(i)||i<0)throw new Error(`${e} must be a non-negative integer`);return i}function T(i,e){return Q("job_queue",i,e)}var Y=i=>i.action,y=class extends F{_pending;_jobs;_seqCursor;pending;jobs;depth;events;audit;constructor(e,t={}){super(e,t.graph),this._pending=G([],{name:"pending"}),this._jobs=I({name:"jobs"}),this.pending=this._pending.items,this.jobs=this._jobs.entries,this.add(this.pending,{name:"pending"}),this.add(this.jobs,{name:"jobs"}),this.depth=P([this.pending],([o])=>o.length,{name:"depth",describeKind:"derived",meta:T("queue_depth"),initial:0}),this.add(this.depth,{name:"depth"}),this.addDisposer(v(this.depth)),this.events=L({name:"events",retainedLimit:1024,graph:this}),this.audit=this.events,this._seqCursor=D(this,"seq",0)}_bumpSeq(){let t=(this._seqCursor.cache??0)+1;return this._seqCursor.emit(t),t}attachEventStorage(e){return this.events.attachStorage(e)}enqueue(e,t={}){let o=this._bumpSeq(),n=t.id??`${this.name}-${o}`;if(this._jobs.get(n)!==void 0)throw new Error(`jobQueue("${this.name}"): duplicate job id "${n}"`);let p={id:n,payload:e,attempts:0,metadata:Object.freeze({...t.metadata??{}}),state:"queued"};return this._jobs.set(n,p),this._pending.append(n),this.events.append({action:"enqueue",id:n,payload:e,t_ns:m(),seq:o}),n}claim(e=1){let t=W(e,"job queue claim limit");if(t===0)return[];let o=[];for(;o.length<t&&this.pending.cache.length!==0;){let p=this._pending.pop(0),h=this._jobs.get(p);if(!h||h.state!=="queued")continue;let l={...h,state:"inflight",attempts:h.attempts+1};this._jobs.set(p,l),o.push(l),this.events.append({action:"claim",id:p,attempts:l.attempts,t_ns:m(),seq:this._bumpSeq()})}return o}ack(e){let t=this._jobs.get(e);return!t||t.state!=="inflight"?!1:(this._jobs.delete(e),this.events.append({action:"ack",id:e,attempts:t.attempts,t_ns:m(),seq:this._bumpSeq()}),!0)}nack(e,t={}){let o=this._jobs.get(e);return!o||o.state!=="inflight"?!1:t.requeue??!0?(this._jobs.set(e,{...o,state:"queued"}),this._pending.append(e),this.events.append({action:"nack",id:e,attempts:o.attempts,t_ns:m(),seq:this._bumpSeq()}),!0):(this._jobs.delete(e),this.events.append({action:"nack",id:e,attempts:o.attempts,t_ns:m(),seq:this._bumpSeq()}),!0)}removeById(e){let t=this._jobs.get(e);if(!t)return!1;if(t.state==="queued"){let n=this.pending.cache.indexOf(e);n>=0&&this._pending.pop(n)}return this._jobs.delete(e),this.events.append({action:"remove",id:e,attempts:t.attempts,t_ns:m(),seq:this._bumpSeq()}),!0}consumeFrom(e,t){return e.subscribe(o=>{for(let n of o){if(n[0]!==N)continue;let p=n[1];this.enqueue(p,t?{metadata:t.metadata}:void 0)}})}},w=class extends F{_stageNames;_stageWorkFns;_queues=new Map;_completed;completed;completedCount;constructor(e,t={}){super(e,t.graph);let o=t.stages??["incoming","processing","done"],n=[],p=new Map;for(let s of o){let r=typeof s=="string"?s.trim():s.name.trim();typeof s!="string"&&s.work&&p.set(r,s.work),n.push(r)}if(n.length<2)throw new Error(`jobFlow("${e}"): requires at least 2 stages`);if(new Set(n).size!==n.length)throw new Error(`jobFlow("${e}"): stage names must be unique`);this._stageNames=Object.freeze([...n]),this._stageWorkFns=p;for(let s of this._stageNames){let r=z(`${e}-${s}`);this._queues.set(s,r),this.mount(s,r)}this._completed=M([],{name:"completed",maxSize:H}),this.completed=this._completed.entries,this.add(this.completed,{name:"completed"}),this.completedCount=P([this.completed],([s])=>s.length,{name:"completedCount",describeKind:"derived",meta:T("job_flow_completed_count"),initial:0}),this.add(this.completedCount,{name:"completedCount"}),this.addDisposer(v(this.completedCount));let l=Math.max(1,W(t.maxPerPump??X,"job flow maxPerPump"));for(let s=0;s<this._stageNames.length;s+=1){let r=this._stageNames[s],d=this.queue(r),q=s+1<this._stageNames.length?this.queue(this._stageNames[s+1]):null,R=this._stageWorkFns.get(r),S=q===null;if(R){let g=x([d.pending],()=>{let c=0;for(;c<l;){let b=d.claim(1);if(b.length===0)break;let a=b[0];if(!a)break;let j=[...a.metadata.job_flow_path??[],r],f;try{f=R(a)}catch{d.nack(a.id,{requeue:!1}),c+=1;continue}let k=C(f),E=!1,u;u=k.subscribe(K=>{if(!E){for(let J of K)if(J[0]===N){E=!0,u?u():Promise.resolve().then(()=>u?.());let O=J[1],$={...a.metadata,job_flow_path:j};if(S){let U={...a,payload:O,metadata:Object.freeze($)};_(()=>{d.ack(a.id),this._completed.append(U)})}else _(()=>{d.ack(a.id),q.enqueue(O,{metadata:$})});return}else if(J[0]===A){E=!0,u?u():Promise.resolve().then(()=>u?.()),d.nack(a.id,{requeue:!1});return}}}),c+=1}},{name:`pump_${r}`,describeKind:"effect",meta:T("job_flow_pump",{stage:r,has_work:!0})});this.add(g,{name:`pump_${r}`}),this.addDisposer(v(g))}else{let g=x([d.pending],()=>{let c=0;for(;c<l;){let b=d.claim(1);if(b.length===0)break;let a=b[0];if(!a)break;let j=[...a.metadata.job_flow_path??[],r],f={...a.metadata,job_flow_path:j};if(S){let k={...a,metadata:Object.freeze(f)};_(()=>{d.ack(a.id),this._completed.append(k)})}else _(()=>{d.ack(a.id),q.enqueue(a.payload,{metadata:f})});c+=1}},{name:`pump_${r}`,describeKind:"effect",meta:T("job_flow_pump",{stage:r,has_work:!1})});this.add(g,{name:`pump_${r}`}),this.addDisposer(v(g))}}}stages(){return this._stageNames}queue(e){let t=this._queues.get(e);if(!t)throw new Error(`jobFlow("${this.name}"): unknown stage "${e}"`);return t}enqueue(e,t={}){return this.queue(this._stageNames[0]).enqueue(e,t)}retainedCompleted(){return this.completed.cache}};function z(i,e){return new y(i,e)}function Z(i,e){return new w(i,e)}export{Y as a,y as b,w as c,z as d,Z as e,ee as f};
|