@graphrefly/graphrefly 0.30.0 → 0.32.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/{cascading-dNCtjW8j.d.cts → cascading-BfQmSmjU.d.cts} +21 -2
- package/dist/{cascading-BszPheHD.d.ts → cascading-D3sapjue.d.ts} +21 -2
- package/dist/chunk-2JNT5NDF.js +61 -0
- package/dist/{chunk-DDPYNMGG.js → chunk-2RH4QNDQ.js} +1 -1
- package/dist/chunk-4JBKKUCJ.js +7 -0
- package/dist/{chunk-SLMYTGTU.js → chunk-4UUDNFYG.js} +1 -1
- package/dist/chunk-4VXL3UZK.js +1 -0
- package/dist/{chunk-SHYH5SXV.js → chunk-4YGJ7KZ6.js} +1 -1
- package/dist/{chunk-GJR3P6JG.js → chunk-5PBXUVHI.js} +1 -1
- package/dist/{chunk-W4TSQ6RJ.js → chunk-7AJKUA36.js} +1 -1
- package/dist/{chunk-XQAXYVXX.js → chunk-7EMUF2RY.js} +1 -1
- package/dist/chunk-7JZ3YORY.js +80 -0
- package/dist/chunk-7QMVU3IX.js +1 -0
- package/dist/{chunk-WANIEEKV.js → chunk-7QS77X6G.js} +1 -1
- package/dist/{chunk-BA5URFYW.js → chunk-A4JT4SAD.js} +1 -1
- package/dist/{chunk-Y36UZ5VS.js → chunk-BU4SUZSA.js} +1 -1
- package/dist/{chunk-P7JXGKDO.js → chunk-CNXUW2CU.js} +1 -1
- package/dist/{chunk-Y32RJO24.js → chunk-CZVYLXFK.js} +1 -1
- package/dist/{chunk-567NWZ3T.js → chunk-DWIAG62L.js} +1 -1
- package/dist/chunk-EIFHFDFD.js +1 -0
- package/dist/chunk-FTA5TB2A.js +1 -0
- package/dist/{chunk-T5SHIKJD.js → chunk-JAHAJU4G.js} +1 -1
- package/dist/{chunk-AV3PIDFQ.js → chunk-JYMNVEH6.js} +1 -1
- package/dist/{chunk-5Z4HDCO6.js → chunk-K54OKWNY.js} +1 -1
- package/dist/chunk-KD3IYBTD.js +3 -0
- package/dist/{chunk-3NEPQO2E.js → chunk-LG73TUF4.js} +2 -2
- package/dist/chunk-LJGPOJHS.js +1 -0
- package/dist/chunk-LWGLBCMU.js +1 -0
- package/dist/{chunk-BKPLTBL5.js → chunk-M2VFLRPJ.js} +1 -1
- package/dist/{chunk-GNCBXARM.js → chunk-MFNOZ5E6.js} +1 -1
- package/dist/{chunk-TWMEGG45.js → chunk-N2KKISCE.js} +1 -1
- package/dist/chunk-PNTBXOQ6.js +5 -0
- package/dist/{chunk-73Z3W2RN.js → chunk-PWKLZ2XU.js} +1 -1
- package/dist/{chunk-7TDOES3L.js → chunk-Q2SY7M7K.js} +1 -1
- package/dist/{chunk-OL33ZI6R.js → chunk-RWGJQQLT.js} +1 -1
- package/dist/chunk-SGS4OJGS.js +1 -0
- package/dist/{chunk-4OFIQ66T.js → chunk-TOCCHQI6.js} +1 -1
- package/dist/chunk-UMH3HSP7.js +1 -0
- package/dist/{chunk-XHVB6G6M.js → chunk-UXEB35L4.js} +1 -1
- package/dist/{chunk-33FA6V4B.js → chunk-VXJX3ZZP.js} +1 -1
- package/dist/{chunk-BZP5T4X6.js → chunk-W6FQIFVE.js} +1 -1
- package/dist/{chunk-RD52SNH2.js → chunk-WE32AFFA.js} +1 -1
- package/dist/{chunk-KA6MMXIY.js → chunk-WF3V5X2L.js} +1 -1
- package/dist/chunk-WQ7I7JVU.js +1 -0
- package/dist/{chunk-4JJCCD5S.js → chunk-X4OOM6QU.js} +1 -1
- package/dist/{chunk-AUY2YKCO.js → chunk-XRSHMHEG.js} +1 -1
- package/dist/chunk-Y26UN6J5.js +18 -0
- package/dist/{chunk-VWPRPPKR.js → chunk-ZWETYYQG.js} +1 -1
- package/dist/compat/index.cjs +2 -2
- package/dist/compat/index.d.cts +5 -5
- package/dist/compat/index.d.ts +5 -5
- package/dist/compat/index.js +1 -1
- package/dist/compat/jotai/index.cjs +1 -1
- package/dist/compat/jotai/index.js +1 -1
- package/dist/compat/nanostores/index.cjs +1 -1
- package/dist/compat/nanostores/index.js +1 -1
- package/dist/compat/nestjs/index.cjs +5 -5
- package/dist/compat/nestjs/index.d.cts +3 -3
- package/dist/compat/nestjs/index.d.ts +3 -3
- package/dist/compat/nestjs/index.js +1 -1
- package/dist/compat/zustand/index.cjs +2 -2
- package/dist/compat/zustand/index.d.cts +2 -2
- package/dist/compat/zustand/index.d.ts +2 -2
- package/dist/compat/zustand/index.js +1 -1
- package/dist/{composite-DGspwCqk.d.ts → composite-BY9hMxN7.d.ts} +1 -1
- package/dist/{composite-nrRumJ7l.d.cts → composite-CH0S8DFn.d.cts} +1 -1
- package/dist/content-addressed-storage-BUiREIuj.d.ts +124 -0
- package/dist/content-addressed-storage-DqIWCmZG.d.cts +124 -0
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.js +1 -1
- package/dist/extra/browser.cjs +1 -1
- package/dist/extra/browser.js +1 -1
- package/dist/extra/index.cjs +18 -18
- package/dist/extra/index.d.cts +7 -6
- package/dist/extra/index.d.ts +7 -6
- package/dist/extra/index.js +1 -1
- package/dist/extra/node.cjs +2 -2
- package/dist/extra/node.js +1 -1
- package/dist/extra/operators.cjs +1 -1
- package/dist/extra/operators.d.cts +41 -1
- package/dist/extra/operators.d.ts +41 -1
- package/dist/extra/operators.js +1 -1
- package/dist/extra/reactive.cjs +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.d.cts +62 -2
- package/dist/extra/sources.d.ts +62 -2
- package/dist/extra/sources.js +1 -1
- package/dist/extra/storage-browser.cjs +1 -1
- package/dist/extra/storage-browser.js +1 -1
- package/dist/{fallback-BaTS7vVY.d.cts → fallback-Cb3GH1O7.d.cts} +6 -14
- package/dist/{fallback-eOm3LNxP.d.ts → fallback-DRjJ_ZM8.d.ts} +6 -14
- package/dist/graph/index.cjs +4 -4
- package/dist/graph/index.d.cts +3 -3
- package/dist/graph/index.d.ts +3 -3
- package/dist/graph/index.js +1 -1
- package/dist/{graph-CWeI0aHd.d.ts → graph-BOhEGJ6E.d.ts} +10 -0
- package/dist/{graph-C4Uxwv0T.d.cts → graph-CdJeX7O7.d.cts} +10 -0
- package/dist/{index-B-z8WaSd.d.cts → index-BDLy6CQ9.d.cts} +1 -1
- package/dist/{index-iBp74eGU.d.cts → index-BJDXj9Wf.d.cts} +2 -2
- package/dist/{index-BBINVimG.d.ts → index-BUZPTPSQ.d.ts} +2 -2
- package/dist/{index-DnrZghBB.d.ts → index-BbcSZCAG.d.ts} +1 -1
- package/dist/{index-lKuLYmHO.d.cts → index-BiGeETJs.d.cts} +1 -1
- package/dist/{index-BHu_Wba0.d.cts → index-BmZb8fNF.d.cts} +3 -3
- package/dist/{index-Docdiu9a.d.ts → index-Bnmttu35.d.ts} +1 -1
- package/dist/{index-D6ajK8Mh.d.cts → index-BuN2wGJs.d.cts} +517 -134
- package/dist/{index-Cy7eFeIX.d.cts → index-BwdPDWI4.d.cts} +1 -1
- package/dist/{index-DylQCKEL.d.cts → index-BzxU4yhV.d.cts} +11 -2
- package/dist/{index-D9Y_u6BG.d.cts → index-C-Gsh-0a.d.cts} +2 -2
- package/dist/{index-ybtSyjWB.d.cts → index-C22aTC1X.d.cts} +5 -5
- package/dist/{index-yIdWFo2b.d.cts → index-C4QTaDli.d.cts} +2 -2
- package/dist/{index-BJHQUCZx.d.ts → index-C7RqYbOZ.d.ts} +82 -7
- package/dist/{index-C5Ghnp5B.d.ts → index-C9qCLIN4.d.ts} +2 -2
- package/dist/{index-DVNLe3pS.d.cts → index-CCdg0JLX.d.cts} +1 -1
- package/dist/{index-B5iVOD7w.d.ts → index-CEoU-r-g.d.ts} +2 -2
- package/dist/{index-CfFYyLR8.d.ts → index-CHfBm51k.d.ts} +11 -2
- package/dist/{index-Dljd76bC.d.ts → index-CNyiYQWF.d.ts} +5 -5
- package/dist/{index-C6NBfXj-.d.ts → index-CVevMZ0n.d.ts} +2 -2
- package/dist/{index-DGb1awva.d.ts → index-CZUzi6Dy.d.ts} +2 -2
- package/dist/{index-FrYrV-Vf.d.ts → index-Ckl03Q0s.d.ts} +1 -1
- package/dist/{index-Bvi5uJxX.d.ts → index-CmSjld-4.d.ts} +1 -1
- package/dist/{index-9iguV3bF.d.cts → index-CnjUhRbs.d.cts} +2 -2
- package/dist/{index-C98oJsEs.d.cts → index-D3HcdZ4d.d.cts} +1 -1
- package/dist/{index-IZ3l_vQ9.d.ts → index-DD1czHj3.d.ts} +1 -1
- package/dist/{index-BS220yqj.d.cts → index-DNhTQReY.d.cts} +82 -7
- package/dist/{index-UZO988ox.d.cts → index-DSawGt8n.d.cts} +2 -2
- package/dist/{index-CcpEvuPl.d.cts → index-DUkuH3jP.d.cts} +1 -1
- package/dist/{index-CRAkoq-y.d.cts → index-DY2QbdoP.d.cts} +1 -1
- package/dist/{index-CvS9IuTG.d.ts → index-Dbmj0iYR.d.ts} +1 -1
- package/dist/{index-ClgKmOHe.d.ts → index-DhlAMlm9.d.ts} +517 -134
- package/dist/{index-ClB7TCfL.d.cts → index-DlGaEBW5.d.cts} +2 -2
- package/dist/{index-CotRMjtJ.d.ts → index-Dp_pS7Bw.d.ts} +1 -1
- package/dist/{index-Cc8VQIgL.d.ts → index-Dxk-pUQI.d.ts} +2 -2
- package/dist/{index-DBQUKh59.d.cts → index-EGjF6iSY.d.cts} +3 -3
- package/dist/{index-D9HrBx2J.d.ts → index-LGzAYqdR.d.ts} +1 -1
- package/dist/{index-DR3gf_DG.d.cts → index-LzCJ0kMT.d.cts} +2 -2
- package/dist/{index-RQg6lTrN.d.ts → index-MV2yGIAq.d.ts} +2 -2
- package/dist/{index-Bs3-LC83.d.cts → index-_BXz9K7b.d.cts} +1 -1
- package/dist/{index-SSGqF8mI.d.cts → index-aBqZUx3B.d.cts} +1 -1
- package/dist/{index-CFW32Dy1.d.ts → index-eYHRkoK-.d.ts} +1 -1
- package/dist/{index-B2HBxvMb.d.ts → index-gXTVbSax.d.ts} +3 -3
- package/dist/{index-B8Aj_z8S.d.cts → index-j33Lfb1G.d.cts} +23 -2
- package/dist/{index-BEpRsvhg.d.ts → index-lpGUhTBn.d.ts} +3 -3
- package/dist/{index-BXbQUn4n.d.ts → index-zMQIQuDu.d.ts} +23 -2
- package/dist/index.cjs +106 -125
- package/dist/index.d.cts +34 -33
- package/dist/index.d.ts +34 -33
- package/dist/index.js +1 -1
- package/dist/patterns/ai/browser.cjs +5 -22
- package/dist/patterns/ai/browser.d.cts +3 -3
- package/dist/patterns/ai/browser.d.ts +3 -3
- package/dist/patterns/ai/browser.js +1 -1
- package/dist/patterns/ai/index.cjs +30 -44
- package/dist/patterns/ai/index.d.cts +13 -11
- package/dist/patterns/ai/index.d.ts +13 -11
- package/dist/patterns/ai/index.js +1 -1
- package/dist/patterns/ai/node.cjs +2 -2
- package/dist/patterns/ai/node.d.cts +5 -4
- package/dist/patterns/ai/node.d.ts +5 -4
- package/dist/patterns/ai/node.js +1 -1
- package/dist/patterns/audit/index.cjs +3 -3
- package/dist/patterns/audit/index.d.cts +3 -3
- package/dist/patterns/audit/index.d.ts +3 -3
- package/dist/patterns/audit/index.js +1 -1
- package/dist/patterns/cqrs/index.cjs +6 -6
- package/dist/patterns/cqrs/index.d.cts +2 -2
- package/dist/patterns/cqrs/index.d.ts +2 -2
- package/dist/patterns/cqrs/index.js +1 -1
- package/dist/patterns/demo-shell/index.cjs +2 -2
- package/dist/patterns/demo-shell/index.d.cts +3 -3
- package/dist/patterns/demo-shell/index.d.ts +3 -3
- package/dist/patterns/demo-shell/index.js +1 -1
- package/dist/patterns/domain-templates/index.cjs +6 -6
- package/dist/patterns/domain-templates/index.d.cts +2 -2
- package/dist/patterns/domain-templates/index.d.ts +2 -2
- package/dist/patterns/domain-templates/index.js +1 -1
- package/dist/patterns/graphspec/index.cjs +27 -25
- 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 +4 -4
- package/dist/patterns/guarded-execution/index.d.ts +4 -4
- package/dist/patterns/guarded-execution/index.js +1 -1
- package/dist/patterns/harness/index.cjs +12 -11
- package/dist/patterns/harness/index.d.cts +6 -6
- package/dist/patterns/harness/index.d.ts +6 -6
- package/dist/patterns/harness/index.js +1 -1
- package/dist/patterns/job-queue/index.cjs +5 -5
- package/dist/patterns/job-queue/index.d.cts +2 -2
- package/dist/patterns/job-queue/index.d.ts +2 -2
- package/dist/patterns/job-queue/index.js +1 -1
- package/dist/patterns/lens/index.cjs +5 -5
- 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 +4 -4
- package/dist/patterns/memory/index.d.cts +2 -2
- package/dist/patterns/memory/index.d.ts +2 -2
- package/dist/patterns/memory/index.js +1 -1
- package/dist/patterns/messaging/index.cjs +5 -5
- package/dist/patterns/messaging/index.d.cts +2 -2
- package/dist/patterns/messaging/index.d.ts +2 -2
- package/dist/patterns/messaging/index.js +1 -1
- package/dist/patterns/orchestration/index.cjs +7 -7
- package/dist/patterns/orchestration/index.d.cts +2 -2
- package/dist/patterns/orchestration/index.d.ts +2 -2
- package/dist/patterns/orchestration/index.js +1 -1
- package/dist/patterns/reactive-layout/index.cjs +2 -2
- package/dist/patterns/reactive-layout/index.d.cts +3 -3
- package/dist/patterns/reactive-layout/index.d.ts +3 -3
- package/dist/patterns/reactive-layout/index.js +1 -1
- package/dist/patterns/reduction/index.cjs +5 -5
- package/dist/patterns/reduction/index.d.cts +2 -2
- package/dist/patterns/reduction/index.d.ts +2 -2
- 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 +3 -3
- package/dist/patterns/refine-loop/index.d.ts +3 -3
- 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 +3 -3
- package/dist/patterns/resilient-pipeline/index.d.ts +3 -3
- package/dist/patterns/resilient-pipeline/index.js +1 -1
- package/dist/patterns/surface/index.cjs +15 -13
- 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/{reactive-layout-BAr6-_o5.d.ts → reactive-layout-Bq0rA2Wb.d.ts} +1 -1
- package/dist/{reactive-layout-5oEn8lHM.d.cts → reactive-layout-Dhhe54Oj.d.cts} +1 -1
- package/dist/{reactive-map-BvDrRuwt.d.ts → reactive-map-CtRaCddO.d.ts} +59 -1
- package/dist/{reactive-map-CmlPPKHN.d.cts → reactive-map-IJIfZxoh.d.cts} +59 -1
- package/dist/{resilience-XRUF267O.js → resilience-IVNDYORD.js} +1 -1
- package/dist/{topology-tree-CVREibAc.d.cts → topology-tree-CpSjvIXp.d.cts} +1 -1
- package/dist/{topology-tree-CkjojcB6.d.ts → topology-tree-DAbCV2Yw.d.ts} +1 -1
- package/dist/{types-O3GzJY2U.d.cts → types-BgMqbc7N.d.cts} +41 -14
- package/dist/{types-u64Ose53.d.ts → types-CdfO2QTt.d.ts} +41 -14
- package/package.json +1 -1
- package/dist/chunk-2GQREQ6C.js +0 -1
- package/dist/chunk-4C2OR2GH.js +0 -18
- package/dist/chunk-5JDE5JHE.js +0 -1
- package/dist/chunk-7JDLFI6N.js +0 -1
- package/dist/chunk-AMBYCIOH.js +0 -3
- package/dist/chunk-GLSM33ZM.js +0 -78
- package/dist/chunk-ISCENNXS.js +0 -1
- package/dist/chunk-IUK4EFCE.js +0 -1
- package/dist/chunk-KASHOCF5.js +0 -1
- package/dist/chunk-LI3E75VE.js +0 -64
- package/dist/chunk-MGKAO4EK.js +0 -7
- package/dist/chunk-NSG4C6BF.js +0 -23
- package/dist/chunk-VIEUJSTT.js +0 -1
|
@@ -273,6 +273,46 @@ type TapObserver<T> = {
|
|
|
273
273
|
* @category extra
|
|
274
274
|
*/
|
|
275
275
|
declare function tap<T>(source: Node<T>, fnOrObserver: ((value: T) => void) | TapObserver<T>, opts?: ExtraOpts): Node<T>;
|
|
276
|
+
/**
|
|
277
|
+
* Invokes `fn` exactly once on the first qualifying DATA emission, then passes
|
|
278
|
+
* all values (including subsequent DATA) through unchanged.
|
|
279
|
+
*
|
|
280
|
+
* Motivation: call-boundary instrumentation (record stats, debit budget, log
|
|
281
|
+
* first-token latency) where the wrapper is re-subscribed by downstream
|
|
282
|
+
* composition (push-on-subscribe §2.2 would otherwise re-deliver the cached
|
|
283
|
+
* value and re-fire the side effect). The closure guard is scoped to the node
|
|
284
|
+
* instance, so the side effect fires exactly once per node lifetime.
|
|
285
|
+
*
|
|
286
|
+
* By default `null` / `undefined` values pass through WITHOUT counting as
|
|
287
|
+
* "first" — matches the SENTINEL convention (COMPOSITION-GUIDE §8) used by
|
|
288
|
+
* `promptNode`, `fromAny(Promise)`, and friends where a cached `null` means
|
|
289
|
+
* "not yet settled." Pass `where` to override with a custom predicate.
|
|
290
|
+
*
|
|
291
|
+
* @param source - Upstream node.
|
|
292
|
+
* @param fn - Side effect invoked once on the first qualifying value.
|
|
293
|
+
* @param opts - Optional {@link NodeOptions} plus `where` predicate. Default
|
|
294
|
+
* `where: (v) => v != null`.
|
|
295
|
+
* @returns `Node<T>` - Passthrough node.
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```ts
|
|
299
|
+
* import { onFirstData, fromAny } from "@graphrefly/graphrefly-ts";
|
|
300
|
+
*
|
|
301
|
+
* const tap = onFirstData(fromAny(adapter.invoke(msgs)), (resp) => recordStats(resp));
|
|
302
|
+
* ```
|
|
303
|
+
*
|
|
304
|
+
* @category extra
|
|
305
|
+
*/
|
|
306
|
+
declare function onFirstData<T>(source: Node<T>, fn: (value: T) => void, opts?: ExtraOpts & {
|
|
307
|
+
where?: (value: T) => boolean;
|
|
308
|
+
}): Node<T>;
|
|
309
|
+
/**
|
|
310
|
+
* Alias for {@link onFirstData}. Parallels `tap` naming for discoverability —
|
|
311
|
+
* `tapFirst` is the one-shot companion of `tap`.
|
|
312
|
+
*
|
|
313
|
+
* @category extra
|
|
314
|
+
*/
|
|
315
|
+
declare const tapFirst: typeof onFirstData;
|
|
276
316
|
/**
|
|
277
317
|
* Suppresses adjacent duplicates using `equals` (default `Object.is`).
|
|
278
318
|
*
|
|
@@ -907,4 +947,4 @@ declare const throttleTime: typeof throttle;
|
|
|
907
947
|
*/
|
|
908
948
|
declare const catchError: typeof rescue;
|
|
909
949
|
|
|
910
|
-
export { type MergeMapOptions, type TapObserver, type ThrottleOptions, audit, buffer, bufferCount, bufferTime, catchError, combine, combineLatest, concat, concatMap, debounce, debounceTime, delay, distinctUntilChanged, elementAt, exhaustMap, filter, find, first, flatMap, interval, last, map, merge, mergeMap, pairwise, pausable, race, reduce, repeat, rescue, sample, scan, skip, switchMap, take, takeUntil, takeWhile, tap, throttle, throttleTime, timeout, valve, window, windowCount, windowTime, withLatestFrom, zip };
|
|
950
|
+
export { type MergeMapOptions, type TapObserver, type ThrottleOptions, audit, buffer, bufferCount, bufferTime, catchError, combine, combineLatest, concat, concatMap, debounce, debounceTime, delay, distinctUntilChanged, elementAt, exhaustMap, filter, find, first, flatMap, interval, last, map, merge, mergeMap, onFirstData, pairwise, pausable, race, reduce, repeat, rescue, sample, scan, skip, switchMap, take, takeUntil, takeWhile, tap, tapFirst, throttle, throttleTime, timeout, valve, window, windowCount, windowTime, withLatestFrom, zip };
|
|
@@ -273,6 +273,46 @@ type TapObserver<T> = {
|
|
|
273
273
|
* @category extra
|
|
274
274
|
*/
|
|
275
275
|
declare function tap<T>(source: Node<T>, fnOrObserver: ((value: T) => void) | TapObserver<T>, opts?: ExtraOpts): Node<T>;
|
|
276
|
+
/**
|
|
277
|
+
* Invokes `fn` exactly once on the first qualifying DATA emission, then passes
|
|
278
|
+
* all values (including subsequent DATA) through unchanged.
|
|
279
|
+
*
|
|
280
|
+
* Motivation: call-boundary instrumentation (record stats, debit budget, log
|
|
281
|
+
* first-token latency) where the wrapper is re-subscribed by downstream
|
|
282
|
+
* composition (push-on-subscribe §2.2 would otherwise re-deliver the cached
|
|
283
|
+
* value and re-fire the side effect). The closure guard is scoped to the node
|
|
284
|
+
* instance, so the side effect fires exactly once per node lifetime.
|
|
285
|
+
*
|
|
286
|
+
* By default `null` / `undefined` values pass through WITHOUT counting as
|
|
287
|
+
* "first" — matches the SENTINEL convention (COMPOSITION-GUIDE §8) used by
|
|
288
|
+
* `promptNode`, `fromAny(Promise)`, and friends where a cached `null` means
|
|
289
|
+
* "not yet settled." Pass `where` to override with a custom predicate.
|
|
290
|
+
*
|
|
291
|
+
* @param source - Upstream node.
|
|
292
|
+
* @param fn - Side effect invoked once on the first qualifying value.
|
|
293
|
+
* @param opts - Optional {@link NodeOptions} plus `where` predicate. Default
|
|
294
|
+
* `where: (v) => v != null`.
|
|
295
|
+
* @returns `Node<T>` - Passthrough node.
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```ts
|
|
299
|
+
* import { onFirstData, fromAny } from "@graphrefly/graphrefly-ts";
|
|
300
|
+
*
|
|
301
|
+
* const tap = onFirstData(fromAny(adapter.invoke(msgs)), (resp) => recordStats(resp));
|
|
302
|
+
* ```
|
|
303
|
+
*
|
|
304
|
+
* @category extra
|
|
305
|
+
*/
|
|
306
|
+
declare function onFirstData<T>(source: Node<T>, fn: (value: T) => void, opts?: ExtraOpts & {
|
|
307
|
+
where?: (value: T) => boolean;
|
|
308
|
+
}): Node<T>;
|
|
309
|
+
/**
|
|
310
|
+
* Alias for {@link onFirstData}. Parallels `tap` naming for discoverability —
|
|
311
|
+
* `tapFirst` is the one-shot companion of `tap`.
|
|
312
|
+
*
|
|
313
|
+
* @category extra
|
|
314
|
+
*/
|
|
315
|
+
declare const tapFirst: typeof onFirstData;
|
|
276
316
|
/**
|
|
277
317
|
* Suppresses adjacent duplicates using `equals` (default `Object.is`).
|
|
278
318
|
*
|
|
@@ -907,4 +947,4 @@ declare const throttleTime: typeof throttle;
|
|
|
907
947
|
*/
|
|
908
948
|
declare const catchError: typeof rescue;
|
|
909
949
|
|
|
910
|
-
export { type MergeMapOptions, type TapObserver, type ThrottleOptions, audit, buffer, bufferCount, bufferTime, catchError, combine, combineLatest, concat, concatMap, debounce, debounceTime, delay, distinctUntilChanged, elementAt, exhaustMap, filter, find, first, flatMap, interval, last, map, merge, mergeMap, pairwise, pausable, race, reduce, repeat, rescue, sample, scan, skip, switchMap, take, takeUntil, takeWhile, tap, throttle, throttleTime, timeout, valve, window, windowCount, windowTime, withLatestFrom, zip };
|
|
950
|
+
export { type MergeMapOptions, type TapObserver, type ThrottleOptions, audit, buffer, bufferCount, bufferTime, catchError, combine, combineLatest, concat, concatMap, debounce, debounceTime, delay, distinctUntilChanged, elementAt, exhaustMap, filter, find, first, flatMap, interval, last, map, merge, mergeMap, onFirstData, pairwise, pausable, race, reduce, repeat, rescue, sample, scan, skip, switchMap, take, takeUntil, takeWhile, tap, tapFirst, throttle, throttleTime, timeout, valve, window, windowCount, windowTime, withLatestFrom, zip };
|
package/dist/extra/operators.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunk-
|
|
1
|
+
import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunk-WQ7I7JVU.js";import"../chunk-4VVTGLXJ.js";import"../chunk-UMH3HSP7.js";import"../chunk-7AJKUA36.js";import"../chunk-CK2E7BTU.js";import"../chunk-QYADASLV.js";export{G as audit,I as buffer,J as bufferCount,L as bufferTime,W as catchError,r as combine,T as combineLatest,v as concat,z as concatMap,D as debounce,U as debounceTime,C as delay,p as distinctUntilChanged,l as elementAt,y as exhaustMap,b as filter,k as find,i as first,B as flatMap,O as interval,j as last,a as map,t as merge,A as mergeMap,n as onFirstData,q as pairwise,Q as pausable,w as race,d as reduce,P as repeat,R as rescue,F as sample,c as scan,f as skip,x as switchMap,e as take,h as takeUntil,g as takeWhile,m as tap,o as tapFirst,E as throttle,V as throttleTime,H as timeout,S as valve,N as window,K as windowCount,M as windowTime,s as withLatestFrom,u as zip};
|
package/dist/extra/reactive.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var le=Object.defineProperty;var He=Object.getOwnPropertyDescriptor;var Pe=Object.getOwnPropertyNames;var Be=Object.prototype.hasOwnProperty;var Ue=(r,e)=>{for(var n in e)le(r,n,{get:e[n],enumerable:!0})},We=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Pe(e))!Be.call(r,s)&&s!==n&&le(r,s,{get:()=>e[s],enumerable:!(t=He(e,s))||t.enumerable});return r};var $e=r=>We(le({},"__esModule",{value:!0}),r);var hn={};Ue(hn,{NativeIndexBackend:()=>re,NativeListBackend:()=>se,NativeLogBackend:()=>ie,NativeMapBackend:()=>oe,reactiveIndex:()=>dn,reactiveList:()=>un,reactiveLog:()=>cn,reactiveMap:()=>fn});module.exports=$e(hn);var K=0,B=!1,S=[],V=[],F=[],U=[];function xe(){return K>0||B}function Te(){return K>0}function Me(r){K>0?U.push(r):r()}function N(r){K+=1;let e=!1;try{r()}catch(n){throw e=!0,n}finally{if(K-=1,K===0)if(e){if(!B){let n=U.splice(0);for(let t of n)try{t()}catch{}S.length=0,V.length=0,F.length=0}}else je()}}function je(){let r=!B;r&&(B=!0);let e=[],n=0;try{for(;S.length>0||V.length>0||F.length>0||r&&U.length>0;){if(r&&U.length>0){let i=U.splice(0);for(let o of i)try{o()}catch(a){e.push(a)}continue}if(n+=1,n>1e3)throw S.length=0,V.length=0,F.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let s=(S.length>0?S:V.length>0?V:F).splice(0);for(let i of s)try{i()}catch(o){e.push(o)}}}finally{r&&(B=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function Z(r,e,n){if(e.length===0)return;if(e.length===1){let d=n(e[0][0]);if(d<3||!xe()){r(e);return}(d>=5?F:d===4?V:S).push(()=>r(e));return}let t=e.length,s=t,i=t,o=t,a=0;for(;a<t&&n(e[a][0])<3;)a++;for(s=a;a<t&&n(e[a][0])===3;)a++;for(i=a;a<t&&n(e[a][0])===4;)a++;o=a;let u=xe();if(s>0){let d=e.slice(0,s);r(d)}if(i>s){let d=e.slice(s,i);u?S.push(()=>r(d)):r(d)}if(o>i){let d=e.slice(i,o);u?V.push(()=>r(d)):r(d)}if(t>o){let d=e.slice(o,t);u?F.push(()=>r(d)):r(d)}}var W=Symbol.for("graphrefly/START"),y=Symbol.for("graphrefly/DATA"),w=Symbol.for("graphrefly/DIRTY"),O=Symbol.for("graphrefly/RESOLVED"),I=Symbol.for("graphrefly/INVALIDATE"),D=Symbol.for("graphrefly/PAUSE"),$=Symbol.for("graphrefly/RESUME"),A=Symbol.for("graphrefly/TEARDOWN"),C=Symbol.for("graphrefly/COMPLETE"),x=Symbol.for("graphrefly/ERROR"),z=Object.freeze([w]),ce=Object.freeze([O]),qe=Object.freeze([I]),fe=Object.freeze([W]),Ye=Object.freeze([C]),Je=Object.freeze([A]),he=Object.freeze([z]),ke=Object.freeze([ce]),Ne=Object.freeze([qe]),Ae=Object.freeze([Ye]),pe=Object.freeze([Je]);var Xe={name:"json",version:1,contentType:"application/json",encode(r){let e=JSON.stringify(r);return new TextEncoder().encode(e)},decode(r,e){let n=new TextDecoder().decode(r);return JSON.parse(n)}};function Ee(r){r.registerCodec(Xe)}var Ze={type:"system",id:""};function Q(r){if(r==null)return Ze;let{type:e,id:n,...t}=r;return{type:e??"system",id:n??"",...t}}function j(){return Math.trunc(performance.now()*1e6)}function Re(){return Date.now()*1e6}var ee=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=n=>{let t=this._messageTypes.get(n);return t!=null?t.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}registerMessageType(e,n){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:n.tier,wireCrossing:n.wireCrossing??n.tier>=3,metaPassthrough:n.metaPassthrough??!0}),this}messageTier(e){let n=this._messageTypes.get(e);return n!=null?n.tier:1}isWireCrossing(e){let n=this._messageTypes.get(e);return n!=null?n.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let n=this._messageTypes.get(e);return n!=null?n.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}};function Se(r){r.registerMessageType(W,{tier:0,wireCrossing:!1}),r.registerMessageType(w,{tier:1,wireCrossing:!1}),r.registerMessageType(I,{tier:1,wireCrossing:!1,metaPassthrough:!1}),r.registerMessageType(D,{tier:2,wireCrossing:!1}),r.registerMessageType($,{tier:2,wireCrossing:!1}),r.registerMessageType(y,{tier:3,wireCrossing:!0}),r.registerMessageType(O,{tier:3,wireCrossing:!0}),r.registerMessageType(C,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(x,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(A,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var L=class extends Error{actor;action;nodeName;constructor(e,n){super(n??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}};function _e(r){if(r===void 0)return null;if(typeof r=="number"){if(!Number.isFinite(r))throw new TypeError(`Cannot hash non-finite number: ${r}`);if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${r}. Cross-language cid parity is not guaranteed for unsafe integers.`);return r}if(typeof r=="string"||typeof r=="boolean"||r===null)return r;if(Array.isArray(r))return r.map(_e);if(typeof r=="object"&&r!==null){let e={};for(let n of Object.keys(r).sort())e[n]=_e(r[n]);return e}return null}var Qe=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),en=new TextEncoder;function nn(r){let e=en.encode(r),n=e.length,t=n*8,s=n+9+63&-64,i=new Uint8Array(s);i.set(e),i[n]=128;let o=new DataView(i.buffer);o.setUint32(s-4,t>>>0,!1),o.setUint32(s-8,Math.floor(t/4294967296)>>>0,!1);let a=1779033703,u=3144134277,d=1013904242,c=2773480762,_=1359893119,g=2600822924,h=528734635,l=1541459225,f=new Uint32Array(64),p=(T,m)=>T>>>m|T<<32-m;for(let T=0;T<s;T+=64){for(let v=0;v<16;v++)f[v]=o.getUint32(T+v*4,!1);for(let v=16;v<64;v++){let H=f[v-15],P=f[v-2],X=p(H,7)^p(H,18)^H>>>3,ue=p(P,17)^p(P,19)^P>>>10;f[v]=f[v-16]+X+f[v-7]+ue>>>0}let m=a,R=u,M=d,ae=c,k=_,Y=g,J=h,de=l;for(let v=0;v<64;v++){let H=p(k,6)^p(k,11)^p(k,25),P=k&Y^~k&J,X=de+H+P+Qe[v]+f[v]>>>0,ue=p(m,2)^p(m,13)^p(m,22),Le=m&R^m&M^R&M,Ge=ue+Le>>>0;de=J,J=Y,Y=k,k=ae+X>>>0,ae=M,M=R,R=m,m=X+Ge>>>0}a=a+m>>>0,u=u+R>>>0,d=d+M>>>0,c=c+ae>>>0,_=_+k>>>0,g=g+Y>>>0,h=h+J>>>0,l=l+de>>>0}let b=T=>T.toString(16).padStart(8,"0");return b(a)+b(u)+b(d)+b(c)+b(_)+b(g)+b(h)+b(l)}function ge(r){let e=_e(r??null),n=JSON.stringify(e);return nn(n).slice(0,16)}function tn(){let r=globalThis.crypto;if(r?.randomUUID)return r.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),n=e()+e()+e()+e();return`${n.slice(0,8)}-${n.slice(8,12)}-4${n.slice(13,16)}-${(parseInt(n.slice(16,17),16)&3|8).toString(16)}${n.slice(17,20)}-${n.slice(20,32)}`}function ye(r,e,n){let t=n?.id??tn();if(r===0)return{id:t,version:0};let i=(n?.hash??ge)(e);return{id:t,version:0,cid:i,prev:null}}function Ve(r,e,n){r.version+=1,"cid"in r&&(r.prev=r.cid,r.cid=n(e))}var Oe=()=>{},Ie=100;function De(r){return{node:r,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function be(r){r.prevData=void 0,r.dirty=!1,r.involvedThisWave=!1,r.dataBatch.length=0,r.terminal=void 0}function ne(r){return r.length===0?r:typeof r[0]=="symbol"?[r]:r}var rn=(r,e,n,t)=>{n.direction==="down-in"&&r._onDepMessage(n.depIndex,e)},sn=(r,e,n,t)=>{let s=r;if(s._status==="completed"||s._status==="errored")return;let i=s._cached,o=i===void 0?[fe]:[fe,[y,i]];s._status==="dirty"&&o.push(z),Z(e,o,s._config.tierOf)},ve=new ee({onMessage:rn,onSubscribe:sn});Se(ve);Ee(ve);var te=class r{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,n,t){this._config=t.config??ve,this._config.onMessage,this._optsName=t.name,this._describeKind=t.describeKind,this._equals=t.equals??Object.is,this._resubscribable=t.resubscribable??!1,this._resetOnTeardown=t.resetOnTeardown??!1,this._autoComplete=t.completeWhenDepsComplete??!0,this._autoError=t.errorWhenDepsError??!0,this._pausable=t.pausable??!0,this._guard=t.guard,this._fn=n,this._partial=t.partial??!1,this._cached=t.initial!==void 0?t.initial:void 0,this._status=e.length===0&&n==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=t.versioningHash??this._config.defaultHashFn??ge;let s=t.versioning??this._config.defaultVersioning;this._versioningLevel=s,this._versioning=s!=null?ye(s,this._cached===void 0?void 0:this._cached,{id:t.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(De);let i={};for(let[a,u]of Object.entries(t.meta??{})){let d={initial:u,name:`${t.name??"node"}:meta:${a}`,describeKind:"state",config:this._config};t.guard!=null&&(d.guard=t.guard),i[a]=new r([],void 0,d)}Object.freeze(i),this.meta=i,this._hasMeta=Object.keys(i).length>0;let o=this;this._actions={emit(a){o._emit([[y,a]])},down(a){o._emit(ne(a))},up(a){o._emitUp(ne(a))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,n){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let t=this._versioningLevel;if(t!=null&&e<=t)return;let s=n?.hash??this._hashFn;s!==this._hashFn&&(this._hashFn=s);let i=this._cached===void 0?void 0:this._cached,o=this._versioning,a=o?.id??n?.id,u=o?.version??0,d=ye(e,i,{id:a,hash:s});d.version=u,this._versioning=d,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let n=Q(e);if(this._guard!=null&&!this._guard(n,"observe"))return!1;if(this._extraGuards!=null){for(let t of this._extraGuards)if(!t(n,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let n=this._guard!=null||this._extraGuards!=null,t=e?.actor!=null;if(!n&&!t)return;let s=Q(e?.actor),i=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(s,i))throw new L({actor:s,action:i,nodeName:this.name});if(this._extraGuards!=null){for(let o of this._extraGuards)if(!o(s,i))throw new L({actor:s,action:i,nodeName:this.name})}this._lastMutation={actor:s,timestamp_ns:Re()}}down(e,n){let t=ne(e);t.length!==0&&(this._checkGuard(n),this._emit(t))}emit(e,n){this._checkGuard(n),this._emit([[y,e]])}up(e,n){if(this._deps.length===0)return;let t=ne(e);if(t.length===0)return;this._checkGuard(n);let s=n??{internal:!0};this._validateUpTiers(t);for(let i of this._deps)i.node.up?.(t,s)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let n of this._deps)n.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let n=this._config.tierOf;for(let t of e){let s=n(t[0]);if(s===3||s===4)throw new Error(`Node "${this.name}": tier-${s} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,n){if(n!=null&&this._guard!=null){let u=Q(n);if(!this._guard(u,"observe"))throw new L({actor:u,action:"observe",nodeName:this.name})}let s=this._isTerminal&&this._resubscribable;if(s){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let u of this._deps)be(u);if(this._partial===!1){for(let u of this._deps)if(u.prevData!==void 0||u.dataBatch.length!==0||u.terminal!==void 0||u.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let i;try{i=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:s},this._actions)}catch(u){throw this._sinkCount-=1,u}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let o=this._isTerminal;if(this._sinkCount===1&&!o)try{this._activate()}catch(u){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof i=="function")try{i()}catch{}throw u}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let a=!1;return()=>{a||(a=!0,this._sinkCount-=1,this._removeSink(e),typeof i=="function"&&i(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[n]=this._sinks;this._sinks=n}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,n=0;try{for(let t=0;t<e;t++){let s=t,i=this._deps[t];i.unsub=Oe,i.unsub=i.node.subscribe(o=>{if(i.unsub===null)return;let a=this._config.tierOf,u=!1;for(let d of o)a(d[0])>=3&&(u=!0),this._config.onMessage(this,d,{direction:"down-in",depIndex:s},this._actions);u&&this._maybeRunFnOnSettlement()}),n++}}catch(t){this._deps[n].unsub=null;for(let s=0;s<n;s++){let i=this._deps[s];if(i.unsub!=null){let o=i.unsub;i.unsub=null;try{o()}catch{}be(i)}}throw this._dirtyDepCount=0,t}}_addDep(e){for(let s=0;s<this._deps.length;s++)if(this._deps[s].node===e)return s;let n=this._deps.length,t=De(e);if(this._deps.push(t),this._sinks==null)return n;t.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(he),t.unsub=Oe;try{t.unsub=e.subscribe(s=>{if(t.unsub===null)return;let i=this._config.tierOf,o=!1;for(let a of s)i(a[0])>=3&&(o=!0),this._config.onMessage(this,a,{direction:"down-in",depIndex:n},this._actions);o&&this._maybeRunFnOnSettlement()})}catch(s){throw t.unsub=null,this._deps.pop(),this._dirtyDepCount--,s}return n}_deactivate(e=!1){let n=this._cleanup;if(this._cleanup=void 0,typeof n=="function")try{n()}catch(t){this._emit([[x,this._wrapFnError("cleanup threw",t)]])}else if(n!=null&&typeof n=="object"){let t=n.deactivate;if(typeof t=="function")try{t()}catch(s){this._emit([[x,this._wrapFnError("cleanup.deactivate threw",s)]])}}for(let t of this._deps){if(t.unsub!=null){let s=t.unsub;t.unsub=null;try{s()}catch{}}be(t)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,n){let t=this._deps[e],s=n[0];if(this._inspectorHooks!=null){let i={kind:"dep_message",depIndex:e,message:n};for(let o of this._inspectorHooks)o(i)}if(s!==W){if(s===w){this._depDirtied(t);return}if(s===I){this._depInvalidated(t),this._emit(Ne);return}if(s===D||s===$){this._emit([n]);return}if(s===A){this._emit(pe);return}if(s===y)this._depSettledAsData(t,n[1]);else if(s===O)this._depSettledAsResolved(t);else if(s===C)this._depSettledAsTerminal(t,!0);else if(s===x)this._depSettledAsTerminal(t,n[1]);else{this._emit([n]);return}if(!this._fn){(s===y||s===O)&&this._emit([n]),(s===C||s===x)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(he))}_depSettledAsData(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(n),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=n,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(!this._partial&&!this._hasCalledFnOnce)for(let e=0;e<this._deps.length;e++){let n=this._deps[e];if(n.dataBatch.length===0&&n.prevData===void 0&&n.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(ke),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(n=>n.terminal!==void 0&&n.terminal!==!0);if(e!=null){this._autoError&&this._emit([[x,e.terminal]]);return}this._autoComplete&&this._deps.every(n=>n.terminal!==void 0)&&this._emit(Ae)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(o){this._emit([[x,this._wrapFnError("cleanup threw",o)]]);return}}else if(e!=null&&typeof e=="object"){let o=e.beforeRun;if(typeof o=="function"){e.beforeRun=void 0;try{o()}catch(a){this._emit([[x,this._wrapFnError("cleanup.beforeRun threw",a)]]);return}}}let n=this._deps.map(o=>o.involvedThisWave?o.dataBatch.length>0?[...o.dataBatch]:[]:void 0),t=this._deps.map(o=>o.prevData);for(let o=0;o<this._deps.length;o++){let a=n[o];a!=null&&a.length>0&&(this._deps[o].prevData=a[a.length-1])}let s=this._deps.map(o=>o.terminal),i={prevData:t,terminalDeps:s,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let o={kind:"run",batchData:n,prevData:t};for(let a of this._inspectorHooks)a(o)}this._isExecutingFn=!0;try{let o=this._fn(n,this._actions,i);if(typeof o=="function")this._cleanup=o;else if(o!=null&&typeof o=="object"){let a=o;(typeof a.beforeRun=="function"||typeof a.deactivate=="function"||typeof a.invalidate=="function")&&(this._cleanup=o)}}catch(o){this._emit([[x,this._wrapFnError("fn threw",o)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>Ie?(this._rerunDepth=0,this._emit([[x,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${Ie} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,n){let t=n instanceof Error?n.message:String(n);return new Error(`Node "${this.name}": ${e}: ${t}`,{cause:n})}_frameBatch(e){let n=this._config.tierOf;if(e.length===1)return n(e[0][0])===3&&this._status!=="dirty"?[z,e[0]]:e;let t=!0,s=!1,i=!1,o=-1;for(let u of e){let d=n(u[0]);d<o&&(t=!1),d===3&&(s=!0),u[0]===w&&(i=!0),o=d}let a=e;if(!t){let u=e.map((d,c)=>({m:d,i:c,tier:n(d[0])}));u.sort((d,c)=>d.tier-c.tier||d.i-c.i),a=u.map(d=>d.m)}if(s&&!i&&this._status!=="dirty"){let u=0;for(;u<a.length&&n(a[u][0])===0;)u++;return u===0?[z,...a]:[...a.slice(0,u),z,...a.slice(u)]}return a}_emit(e){if(e.length===0)return;for(let a=0;a<e.length;a++){let u=e[a];if(u[0]===x&&u[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let n=e;if(this._isTerminal&&!this._resubscribable){let a=e.filter(u=>u[0]===A||u[0]===I);if(a.length===0)return;n=a}n=this._frameBatch(n);let s=null;for(let a=0;a<n.length;a++){let u=n[a],d=u[0];if(d!==D&&d!==$){s?.push(u);continue}if(u.length<2)throw new Error(`Node "${this.name}": [[${d===D?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let c=!0;if(this._pausable!==!1){let _=u[1];if(d===D)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(_),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(_))c=!1;else if(this._pauseLocks.delete(_),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let g=this._pauseBuffer;this._pauseBuffer=[],this._emit(g)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?s?.push(u):s==null&&(s=n.slice(0,a))}if(s!=null){if(s.length===0)return;n=s}if(this._hasMeta&&n.some(a=>a[0]===A))for(let a of Object.keys(this.meta))try{this.meta[a]._emit(pe)}catch{}let{finalMessages:i,equalsError:o}=this._updateState(n);if(i.length>0&&this._config.inspectorEnabled){let a=this._config.globalInspector;if(a!=null)try{a({kind:"emit",node:this,messages:i})}catch{}}if(i.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let a=this._config.tierOf,u=[];for(let d of i)a(d[0])===3?this._pauseBuffer.push(d):u.push(d);u.length>0&&this._dispatchOrAccumulate(u)}else this._dispatchOrAccumulate(i);o!=null&&this._emit([[x,o]])}_updateState(e){let n=this._config.tierOf,t,s,i=-1,o=0;for(let c of e)n(c[0])===3&&o++;let a=o<=1,u=-1;if(this._versioning!=null&&o>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===y){u=c;break}}for(let c=0;c<e.length;c++){let _=e[c],g=_[0];if(g===y){if(_.length>=2){let h=!1;if(a&&this._cached!==void 0)try{h=this._equals(this._cached,_[1])}catch(l){s=this._wrapFnError("equals threw",l),i=c;break}if(h){t==null&&(t=e.slice(0,c)),t.push(ce),this._status="resolved";continue}this._cached=_[1],this._versioning!=null&&(u<0||c===u)&&Ve(this._versioning,_[1],this._hashFn)}this._status="settled",t?.push(_)}else if(t?.push(_),g===w)this._status="dirty";else if(g===O)this._status="resolved";else if(g===C)this._status="completed";else if(g===x)this._status="errored";else if(g===I){this._cached=void 0,this._status="dirty";let h=this._cleanup;if(typeof h=="function"){this._cleanup=void 0;try{h()}catch{}}else if(h!=null&&typeof h=="object"){let l=h.invalidate;if(typeof l=="function")try{l()}catch{}}}else g===A&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let d=i>=0?t??e.slice(0,i):t??e;return s!=null?{finalMessages:d,equalsError:s}:{finalMessages:d}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let n=[...this._sinks];for(let t of n)t(e)};_dispatchOrAccumulate(e){if(Te()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Me(()=>this._flushBatchPending()));for(let n of e)this._batchPendingMessages.push(n);return}Z(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let n=this._frameBatch(e);Z(this._deliverToSinks,n,this._config.tierOf)}},Ce=r=>Array.isArray(r),me=r=>typeof r=="object"&&r!=null&&!Array.isArray(r);function we(r,e,n){let t=Ce(r)?r:[],s=typeof r=="function"?r:typeof e=="function"?e:void 0,i={};return Ce(r)?i=(me(e)?e:n)??{}:me(r)?i=r:i=(me(e)?e:n)??{},new te(t,s,i)}function E(r,e){return we([],{...e,initial:r})}function q(r,e,n){return we(r,(s,i,o)=>{let a=s.map((u,d)=>u!=null&&u.length>0?u.at(-1):o.prevData[d]);i.emit(e(a,o))},{describeKind:"derived",...n})}function Ke(r,e){if(r===e)return 0;let n=typeof r;if(n===typeof e&&(n==="number"||n==="string"||n==="boolean"||n==="bigint")){let s=r,i=e;return s<i?-1:s>i?1:0}return String(r).localeCompare(String(e))}function on(r,e){let n=Ke(r[0],e[0]);return n!==0?n:Ke(r[1],e[1])}function Fe(r){return[r.secondary,r.primary]}function G(r,e){let n=Fe(e),t=0,s=r.length;for(;t<s;){let i=t+s>>1;on(n,Fe(r[i]))>0?t=i+1:s=i}return t}var re=class{_version=0;_buf=[];_byPrimary=new Map;get version(){return this._version}get size(){return this._buf.length}has(e){return this._byPrimary.has(e)}get(e){return this._byPrimary.get(e)?.value}upsert(e,n,t,s){let i=this._byPrimary.get(e),o={primary:e,secondary:n,value:t};if(i!==void 0&&s?.equals?.(i,o))return!1;if(i!==void 0){let u=G(this._buf,i);this._buf.splice(u,1)}let a=G(this._buf,o);return this._buf.splice(a,0,o),this._byPrimary.set(e,o),this._version+=1,i===void 0}upsertMany(e,n){let t=0;try{for(let s of e){let i=this._byPrimary.get(s.primary),o={primary:s.primary,secondary:s.secondary,value:s.value};if(i!==void 0&&n?.equals?.(i,o))continue;if(i!==void 0){let u=G(this._buf,i);this._buf.splice(u,1)}let a=G(this._buf,o);this._buf.splice(a,0,o),this._byPrimary.set(s.primary,o),t+=1}}finally{t>0&&(this._version+=1)}return t}delete(e){let n=this._byPrimary.get(e);if(n===void 0)return!1;let t=G(this._buf,n);return this._buf.splice(t,1),this._byPrimary.delete(e),this._version+=1,!0}deleteMany(e){let n=0;try{for(let t of e){let s=this._byPrimary.get(t);if(s===void 0)continue;let i=G(this._buf,s);this._buf.splice(i,1),this._byPrimary.delete(t),n+=1}}finally{n>0&&(this._version+=1)}return n}clear(){let e=this._buf.length;return e===0?0:(this._buf.length=0,this._byPrimary.clear(),this._version+=1,e)}toArray(){return[...this._buf]}toPrimaryMap(){let e=new Map;for(let n of this._buf)e.set(n.primary,n.value);return e}};function an(r){return r.subscribe(()=>{})}function dn(r={}){let{name:e,versioning:n,equals:t,backend:s}=r,i=s??new re;function o(h){return h?.equals!==void 0||t===void 0?h:{...h,equals:t}}let a=E([],{name:e,describeKind:"state",equals:(h,l)=>h===l,...n!=null?{versioning:n}:{}}),u=q([a],([h])=>{let l=h,f=new Map;for(let p of l)f.set(p.primary,p.value);return f},{initial:i.toPrimaryMap(),describeKind:"derived"}),d=an(u),c=!1;function _(){let h=i.toArray();N(()=>{a.down([[w]]),a.down([[y,h]])})}function g(h){let l=i.version;try{return h()}finally{i.version!==l&&_()}}return{ordered:a,byPrimary:u,has(h){return i.has(h)},get(h){return i.get(h)},get size(){return i.size},upsert(h,l,f,p){return g(()=>i.upsert(h,l,f,o(p)))},upsertMany(h,l){let f=[...h];f.length!==0&&g(()=>i.upsertMany(f,o(l)))},delete(h){g(()=>i.delete(h))},deleteMany(h){let l=[...h];l.length!==0&&g(()=>i.deleteMany(l))},clear(){g(()=>i.clear())},dispose(){c||(c=!0,d())}}}var se=class{_version=0;_buf;constructor(e){this._buf=e?[...e]:[]}get version(){return this._version}get size(){return this._buf.length}at(e){if(!Number.isInteger(e))return;let n=e>=0?e:this._buf.length+e;if(!(n<0||n>=this._buf.length))return this._buf[n]}append(e){this._buf.push(e),this._version+=1}appendMany(e){if(e.length===0)return;let n=this._buf.length;this._buf.length=n+e.length;for(let t=0;t<e.length;t++)this._buf[n+t]=e[t];this._version+=1}insert(e,n){if(!Number.isInteger(e)||e<0||e>this._buf.length)throw new RangeError(`insert: index ${e} out of range [0, ${this._buf.length}]`);this._buf.splice(e,0,n),this._version+=1}insertMany(e,n){if(!Number.isInteger(e)||e<0||e>this._buf.length)throw new RangeError(`insertMany: index ${e} out of range [0, ${this._buf.length}]`);n.length!==0&&(this._buf.splice(e,0,...n),this._version+=1)}pop(e){if(this._buf.length===0)throw new RangeError("pop from empty list");if(!Number.isInteger(e))throw new RangeError(`pop: index ${e} must be an integer`);let n=e>=0?e:this._buf.length+e;if(n<0||n>=this._buf.length)throw new RangeError(`pop: index ${e} out of range`);let[t]=this._buf.splice(n,1);return this._version+=1,t}clear(){let e=this._buf.length;return e===0?0:(this._buf.length=0,this._version+=1,e)}toArray(){return[...this._buf]}};function un(r,e={}){let{name:n,versioning:t,backend:s}=e,i=s??new se(r),o=E(i.toArray(),{name:n,describeKind:"state",equals:(d,c)=>d===c,...t!=null?{versioning:t}:{}});function a(){let d=i.toArray();N(()=>{o.down([[w]]),o.down([[y,d]])})}function u(d){let c=i.version;try{return d()}finally{i.version!==c&&a()}}return{items:o,get size(){return i.size},at(d){return i.at(d)},append(d){u(()=>i.append(d))},appendMany(d){u(()=>i.appendMany(d))},insert(d,c){u(()=>i.insert(d,c))},insertMany(d,c){u(()=>i.insertMany(d,c))},pop(d=-1){return u(()=>i.pop(d))},clear(){u(()=>i.clear())},dispose(){}}}var ie=class{_version=0;_maxSize;_buf;_head=0;_size=0;constructor(e,n){if(n!==void 0&&n<1)throw new RangeError("maxSize must be >= 1");if(this._maxSize=n,n!==void 0){if(this._buf=new Array(n),e&&e.length>0){let t=Math.min(e.length,n),s=e.length-t;for(let i=0;i<t;i++)this._buf[i]=e[s+i];this._size=t}}else this._buf=e?[...e]:[],this._size=this._buf.length}get version(){return this._version}get size(){return this._size}at(e){if(!Number.isInteger(e))return;let n=e>=0?e:this._size+e;if(!(n<0||n>=this._size))return this._maxSize!==void 0?this._buf[(this._head+n)%this._maxSize]:this._buf[n]}append(e){this._rawAppend(e),this._version+=1}appendMany(e){if(e.length===0)return;let n=this._maxSize!==void 0&&e.length>this._maxSize?e.length-this._maxSize:0;for(let t=n;t<e.length;t++)this._rawAppend(e[t]);this._version+=1}clear(){if(this._size===0)return 0;let e=this._size;if(this._maxSize===void 0)this._buf.length=0;else for(let n=0;n<e;n++)this._buf[(this._head+n)%this._maxSize]=void 0;return this._head=0,this._size=0,this._version+=1,e}trimHead(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`trimHead: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return 0;let n=Math.min(e,this._size);if(this._maxSize===void 0)this._buf.splice(0,n);else{for(let t=0;t<n;t++)this._buf[(this._head+t)%this._maxSize]=void 0;this._head=(this._head+n)%this._maxSize}return this._size-=n,this._version+=1,n}slice(e,n){if(!Number.isInteger(e)||e<0)throw new RangeError(`slice: start must be a non-negative integer (got ${e})`);if(n!==void 0&&(!Number.isInteger(n)||n<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${n})`);let t=n===void 0?this._size:Math.min(Math.max(n,0),this._size),s=Math.min(e,this._size);if(s>=t)return[];let i=t-s;if(this._maxSize===void 0)return this._buf.slice(s,t);let o=new Array(i);for(let a=0;a<i;a++)o[a]=this._buf[(this._head+s+a)%this._maxSize];return o}tail(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`tail: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return[];let n=Math.min(e,this._size);return this.slice(this._size-n,this._size)}toArray(){if(this._maxSize===void 0)return[...this._buf];let e=new Array(this._size);for(let n=0;n<this._size;n++)e[n]=this._buf[(this._head+n)%this._maxSize];return e}_rawAppend(e){if(this._maxSize===void 0){this._buf.push(e),this._size=this._buf.length;return}this._size<this._maxSize?(this._buf[(this._head+this._size)%this._maxSize]=e,this._size+=1):(this._buf[this._head]=e,this._head=(this._head+1)%this._maxSize)}};function ze(r){return r.subscribe(()=>{})}var ln=64;function cn(r,e={}){let{name:n,maxSize:t,versioning:s,backend:i}=e,o=i??new ie(r,t),a=E(o.toArray(),{name:n,describeKind:"state",equals:(l,f)=>l===f,...s!=null?{versioning:s}:{}});function u(){let l=o.toArray();N(()=>{a.down([[w]]),a.down([[y,l]])})}let d=new Map,c=new Map;function _(l,f){return`${l}:${f===void 0?"END":f}`}function g(l){if(l.size<ln)return;let f=l.keys().next();if(f.done)return;let p=l.get(f.value);p!==void 0&&p.dispose(),l.delete(f.value)}function h(l){let f=o.version;try{return l()}finally{o.version!==f&&u()}}return{entries:a,get size(){return o.size},at(l){return o.at(l)},append(l){h(()=>o.append(l))},appendMany(l){l.length!==0&&h(()=>o.appendMany(l))},clear(){h(()=>o.clear())},trimHead(l){h(()=>o.trimHead(l))},tail(l){if(!Number.isInteger(l)||l<0)throw new RangeError(`tail: n must be a non-negative integer (got ${l})`);let f=d.get(l);if(f!==void 0)return d.delete(l),d.set(l,f),f.node;g(d);let p=q([a],([T])=>{let m=T;return l===0||m.length===0?[]:m.slice(Math.max(0,m.length-l))},{initial:o.tail(l),describeKind:"derived"}),b=ze(p);return d.set(l,{node:p,dispose:b}),p},slice(l,f){if(!Number.isInteger(l)||l<0)throw new RangeError(`slice: start must be a non-negative integer (got ${l})`);if(f!==void 0&&(!Number.isInteger(f)||f<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${f})`);let p=_(l,f),b=c.get(p);if(b!==void 0)return c.delete(p),c.set(p,b),b.node;g(c);let T=q([a],([R])=>{let M=R;return f===void 0?M.slice(l):M.slice(l,f)},{initial:o.slice(l,f),describeKind:"derived"}),m=ze(T);return c.set(p,{node:T,dispose:m}),T},disposeTail(l){let f=d.get(l);return f===void 0?!1:(f.dispose(),d.delete(l),!0)},disposeSlice(l,f){let p=_(l,f),b=c.get(p);return b===void 0?!1:(b.dispose(),c.delete(p),!0)},disposeAllViews(){for(let l of d.values())l.dispose();d.clear();for(let l of c.values())l.dispose();c.clear()},dispose(){for(let l of d.values())l.dispose();d.clear();for(let l of c.values())l.dispose();c.clear()}}}var oe=class{_version=0;_store=new Map;_maxSize;_defaultTtl;constructor(e={}){let{maxSize:n,defaultTtl:t}=e;if(n!==void 0&&n<1)throw new RangeError("maxSize must be >= 1");if(t!==void 0&&t<=0)throw new RangeError("defaultTtl must be positive");this._maxSize=n,this._defaultTtl=t}get version(){return this._version}get size(){return this._store.size}has(e){let n=this._store.get(e);return n===void 0?!1:this._isExpired(n)?(this._store.delete(e),this._version+=1,!1):(this._touchLru(e,n),!0)}get(e){let n=this._store.get(e);if(n!==void 0){if(this._isExpired(n)){this._store.delete(e),this._version+=1;return}return this._touchLru(e,n),n.value}}set(e,n,t){let s=this._resolveExpiresAt(t);this._store.has(e)&&this._store.delete(e),this._store.set(e,{value:n,expiresAt:s}),this._evictLruWhileOver(),this._version+=1}setMany(e,n){let t=this._resolveExpiresAt(n),s=0;try{for(let[i,o]of e)this._store.has(i)&&this._store.delete(i),this._store.set(i,{value:o,expiresAt:t}),s+=1}finally{s>0&&(this._evictLruWhileOver(),this._version+=1)}}delete(e){let n=this._store.delete(e);return n&&(this._version+=1),n}deleteMany(e){let n=0;try{for(let t of e)this._store.delete(t)&&(n+=1)}finally{n>0&&(this._version+=1)}return n}clear(){let e=this._store.size;return e===0?0:(this._store.clear(),this._version+=1,e)}pruneExpired(){let e=j(),n=0;for(let[t,s]of this._store)this._isExpired(s,e)&&(this._store.delete(t),n+=1);return n>0&&(this._version+=1),n}toMap(){let e=j(),n=new Map;for(let[t,s]of this._store)this._isExpired(s,e)||n.set(t,s.value);return n}_resolveExpiresAt(e){let n=e??this._defaultTtl;if(n!==void 0){if(!Number.isFinite(n)||n<=0)throw new RangeError(`MapBackend: ttl must be a positive finite number (got ${n})`);return j()+n*1e9}}_isExpired(e,n){return e.expiresAt===void 0?!1:(n??j())>=e.expiresAt}_touchLru(e,n){this._store.delete(e),this._store.set(e,n)}_evictLruWhileOver(){if(this._maxSize!==void 0)for(;this._store.size>this._maxSize;){let e=this._store.keys().next().value;if(e===void 0)break;this._store.delete(e)}}};function fn(r={}){let{name:e,maxSize:n,defaultTtl:t,versioning:s,backend:i}=r,o=i??new oe({maxSize:n,defaultTtl:t}),a=E(o.toMap(),{name:e,describeKind:"state",equals:(c,_)=>c===_,...s!=null?{versioning:s}:{}});function u(){let c=o.toMap();N(()=>{a.down([[w]]),a.down([[y,c]])})}function d(c){let _=o.version;try{return c()}finally{o.version!==_&&u()}}return{entries:a,has(c){return d(()=>o.has(c))},get(c){return d(()=>o.get(c))},set(c,_,g){d(()=>o.set(c,_,g?.ttl))},setMany(c,_){d(()=>o.setMany(c,_?.ttl))},delete(c){d(()=>o.delete(c))},deleteMany(c){d(()=>o.deleteMany(c))},clear(){d(()=>o.clear())},pruneExpired(){d(()=>o.pruneExpired())},get size(){return o.size},dispose(){}}}0&&(module.exports={NativeIndexBackend,NativeListBackend,NativeLogBackend,NativeMapBackend,reactiveIndex,reactiveList,reactiveLog,reactiveMap});
|
|
1
|
+
"use strict";var le=Object.defineProperty;var He=Object.getOwnPropertyDescriptor;var Pe=Object.getOwnPropertyNames;var Ue=Object.prototype.hasOwnProperty;var Be=(r,e)=>{for(var n in e)le(r,n,{get:e[n],enumerable:!0})},We=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Pe(e))!Ue.call(r,s)&&s!==n&&le(r,s,{get:()=>e[s],enumerable:!(t=He(e,s))||t.enumerable});return r};var $e=r=>We(le({},"__esModule",{value:!0}),r);var hn={};Be(hn,{NativeIndexBackend:()=>re,NativeListBackend:()=>se,NativeLogBackend:()=>ie,NativeMapBackend:()=>oe,reactiveIndex:()=>dn,reactiveList:()=>un,reactiveLog:()=>cn,reactiveMap:()=>fn});module.exports=$e(hn);var K=0,U=!1,S=[],V=[],z=[],B=[];function xe(){return K>0||U}function Te(){return K>0}function ke(r){K>0?B.push(r):r()}function N(r){K+=1;let e=!1;try{r()}catch(n){throw e=!0,n}finally{if(K-=1,K===0)if(e){if(!U){let n=B.splice(0);for(let t of n)try{t()}catch{}S.length=0,V.length=0,z.length=0}}else je()}}function je(){let r=!U;r&&(U=!0);let e=[],n=0;try{for(;S.length>0||V.length>0||z.length>0||r&&B.length>0;){if(r&&B.length>0){let i=B.splice(0);for(let o of i)try{o()}catch(a){e.push(a)}continue}if(n+=1,n>1e3)throw S.length=0,V.length=0,z.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let s=(S.length>0?S:V.length>0?V:z).splice(0);for(let i of s)try{i()}catch(o){e.push(o)}}}finally{r&&(U=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function Z(r,e,n){if(e.length===0)return;if(e.length===1){let d=n(e[0][0]);if(d<3||!xe()){r(e);return}(d>=5?z:d===4?V:S).push(()=>r(e));return}let t=e.length,s=t,i=t,o=t,a=0;for(;a<t&&n(e[a][0])<3;)a++;for(s=a;a<t&&n(e[a][0])===3;)a++;for(i=a;a<t&&n(e[a][0])===4;)a++;o=a;let u=xe();if(s>0){let d=e.slice(0,s);r(d)}if(i>s){let d=e.slice(s,i);u?S.push(()=>r(d)):r(d)}if(o>i){let d=e.slice(i,o);u?V.push(()=>r(d)):r(d)}if(t>o){let d=e.slice(o,t);u?z.push(()=>r(d)):r(d)}}var W=Symbol.for("graphrefly/START"),b=Symbol.for("graphrefly/DATA"),x=Symbol.for("graphrefly/DIRTY"),O=Symbol.for("graphrefly/RESOLVED"),I=Symbol.for("graphrefly/INVALIDATE"),D=Symbol.for("graphrefly/PAUSE"),$=Symbol.for("graphrefly/RESUME"),A=Symbol.for("graphrefly/TEARDOWN"),C=Symbol.for("graphrefly/COMPLETE"),T=Symbol.for("graphrefly/ERROR"),F=Object.freeze([x]),ce=Object.freeze([O]),qe=Object.freeze([I]),fe=Object.freeze([W]),Ye=Object.freeze([C]),Je=Object.freeze([A]),he=Object.freeze([F]),Me=Object.freeze([ce]),Ne=Object.freeze([qe]),Ae=Object.freeze([Ye]),pe=Object.freeze([Je]);var Xe={name:"json",version:1,contentType:"application/json",encode(r){let e=JSON.stringify(r);return new TextEncoder().encode(e)},decode(r,e){let n=new TextDecoder().decode(r);return JSON.parse(n)}};function Ee(r){r.registerCodec(Xe)}var Ze={type:"system",id:""};function Q(r){if(r==null)return Ze;let{type:e,id:n,...t}=r;return{type:e??"system",id:n??"",...t}}function j(){return Math.trunc(performance.now()*1e6)}function Re(){return Date.now()*1e6}var ee=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=n=>{let t=this._messageTypes.get(n);return t!=null?t.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}registerMessageType(e,n){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:n.tier,wireCrossing:n.wireCrossing??n.tier>=3,metaPassthrough:n.metaPassthrough??!0}),this}messageTier(e){let n=this._messageTypes.get(e);return n!=null?n.tier:1}isWireCrossing(e){let n=this._messageTypes.get(e);return n!=null?n.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let n=this._messageTypes.get(e);return n!=null?n.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}};function Se(r){r.registerMessageType(W,{tier:0,wireCrossing:!1}),r.registerMessageType(x,{tier:1,wireCrossing:!1}),r.registerMessageType(I,{tier:1,wireCrossing:!1,metaPassthrough:!1}),r.registerMessageType(D,{tier:2,wireCrossing:!1}),r.registerMessageType($,{tier:2,wireCrossing:!1}),r.registerMessageType(b,{tier:3,wireCrossing:!0}),r.registerMessageType(O,{tier:3,wireCrossing:!0}),r.registerMessageType(C,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(T,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(A,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var L=class extends Error{actor;action;nodeName;constructor(e,n){super(n??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}};function _e(r){if(r===void 0)return null;if(typeof r=="number"){if(!Number.isFinite(r))throw new TypeError(`Cannot hash non-finite number: ${r}`);if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${r}. Cross-language cid parity is not guaranteed for unsafe integers.`);return r}if(typeof r=="string"||typeof r=="boolean"||r===null)return r;if(Array.isArray(r))return r.map(_e);if(typeof r=="object"&&r!==null){let e={};for(let n of Object.keys(r).sort())e[n]=_e(r[n]);return e}return null}var Qe=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),en=new TextEncoder;function nn(r){let e=en.encode(r),n=e.length,t=n*8,s=n+9+63&-64,i=new Uint8Array(s);i.set(e),i[n]=128;let o=new DataView(i.buffer);o.setUint32(s-4,t>>>0,!1),o.setUint32(s-8,Math.floor(t/4294967296)>>>0,!1);let a=1779033703,u=3144134277,d=1013904242,f=2773480762,y=1359893119,p=2600822924,c=528734635,l=1541459225,h=new Uint32Array(64),_=(m,v)=>m>>>v|m<<32-v;for(let m=0;m<s;m+=64){for(let w=0;w<16;w++)h[w]=o.getUint32(m+w*4,!1);for(let w=16;w<64;w++){let H=h[w-15],P=h[w-2],X=_(H,7)^_(H,18)^H>>>3,ue=_(P,17)^_(P,19)^P>>>10;h[w]=h[w-16]+X+h[w-7]+ue>>>0}let v=a,R=u,k=d,ae=f,M=y,Y=p,J=c,de=l;for(let w=0;w<64;w++){let H=_(M,6)^_(M,11)^_(M,25),P=M&Y^~M&J,X=de+H+P+Qe[w]+h[w]>>>0,ue=_(v,2)^_(v,13)^_(v,22),Le=v&R^v&k^R&k,Ge=ue+Le>>>0;de=J,J=Y,Y=M,M=ae+X>>>0,ae=k,k=R,R=v,v=X+Ge>>>0}a=a+v>>>0,u=u+R>>>0,d=d+k>>>0,f=f+ae>>>0,y=y+M>>>0,p=p+Y>>>0,c=c+J>>>0,l=l+de>>>0}let g=m=>m.toString(16).padStart(8,"0");return g(a)+g(u)+g(d)+g(f)+g(y)+g(p)+g(c)+g(l)}function ge(r){let e=_e(r??null),n=JSON.stringify(e);return nn(n).slice(0,16)}function tn(){let r=globalThis.crypto;if(r?.randomUUID)return r.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),n=e()+e()+e()+e();return`${n.slice(0,8)}-${n.slice(8,12)}-4${n.slice(13,16)}-${(parseInt(n.slice(16,17),16)&3|8).toString(16)}${n.slice(17,20)}-${n.slice(20,32)}`}function ye(r,e,n){let t=n?.id??tn();if(r===0)return{id:t,version:0};let i=(n?.hash??ge)(e);return{id:t,version:0,cid:i,prev:null}}function Ve(r,e,n){r.version+=1,"cid"in r&&(r.prev=r.cid,r.cid=n(e))}var Oe=()=>{},Ie=100;function De(r){return{node:r,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function me(r){r.prevData=void 0,r.dirty=!1,r.involvedThisWave=!1,r.dataBatch.length=0,r.terminal=void 0}function ne(r){return r.length===0?r:typeof r[0]=="symbol"?[r]:r}var rn=(r,e,n,t)=>{n.direction==="down-in"&&r._onDepMessage(n.depIndex,e)},sn=(r,e,n,t)=>{let s=r;if(s._status==="completed"||s._status==="errored")return;let i=s._cached,o=i===void 0?[fe]:[fe,[b,i]];s._status==="dirty"&&o.push(F),Z(e,o,s._config.tierOf)},ve=new ee({onMessage:rn,onSubscribe:sn});Se(ve);Ee(ve);var te=class r{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,n,t){this._config=t.config??ve,this._config.onMessage,this._optsName=t.name,this._describeKind=t.describeKind,this._equals=t.equals??Object.is,this._resubscribable=t.resubscribable??!1,this._resetOnTeardown=t.resetOnTeardown??!1,this._autoComplete=t.completeWhenDepsComplete??!0,this._autoError=t.errorWhenDepsError??!0,this._pausable=t.pausable??!0,this._guard=t.guard,this._fn=n,this._partial=t.partial??!1,this._cached=t.initial!==void 0?t.initial:void 0,this._status=e.length===0&&n==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=t.versioningHash??this._config.defaultHashFn??ge;let s=t.versioning??this._config.defaultVersioning;this._versioningLevel=s,this._versioning=s!=null?ye(s,this._cached===void 0?void 0:this._cached,{id:t.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(De);let i={};for(let[a,u]of Object.entries(t.meta??{})){let d={initial:u,name:`${t.name??"node"}:meta:${a}`,describeKind:"state",config:this._config};t.guard!=null&&(d.guard=t.guard),i[a]=new r([],void 0,d)}Object.freeze(i),this.meta=i,this._hasMeta=Object.keys(i).length>0;let o=this;this._actions={emit(a){o._emit([[b,a]])},down(a){o._emit(ne(a))},up(a){o._emitUp(ne(a))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,n){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let t=this._versioningLevel;if(t!=null&&e<=t)return;let s=n?.hash??this._hashFn;s!==this._hashFn&&(this._hashFn=s);let i=this._cached===void 0?void 0:this._cached,o=this._versioning,a=o?.id??n?.id,u=o?.version??0,d=ye(e,i,{id:a,hash:s});d.version=u,this._versioning=d,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let n=Q(e);if(this._guard!=null&&!this._guard(n,"observe"))return!1;if(this._extraGuards!=null){for(let t of this._extraGuards)if(!t(n,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let n=this._guard!=null||this._extraGuards!=null,t=e?.actor!=null;if(!n&&!t)return;let s=Q(e?.actor),i=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(s,i))throw new L({actor:s,action:i,nodeName:this.name});if(this._extraGuards!=null){for(let o of this._extraGuards)if(!o(s,i))throw new L({actor:s,action:i,nodeName:this.name})}this._lastMutation={actor:s,timestamp_ns:Re()}}down(e,n){let t=ne(e);t.length!==0&&(this._checkGuard(n),this._emit(t))}emit(e,n){this._checkGuard(n),this._emit([[b,e]])}up(e,n){if(this._deps.length===0)return;let t=ne(e);if(t.length===0)return;this._checkGuard(n);let s=n??{internal:!0};this._validateUpTiers(t);for(let i of this._deps)i.node.up?.(t,s)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let n of this._deps)n.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let n=this._config.tierOf;for(let t of e){let s=n(t[0]);if(s===3||s===4)throw new Error(`Node "${this.name}": tier-${s} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,n){if(n!=null&&this._guard!=null){let u=Q(n);if(!this._guard(u,"observe"))throw new L({actor:u,action:"observe",nodeName:this.name})}let s=this._isTerminal&&this._resubscribable;if(s){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let u of this._deps)me(u);if(this._partial===!1){for(let u of this._deps)if(u.prevData!==void 0||u.dataBatch.length!==0||u.terminal!==void 0||u.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let i;try{i=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:s},this._actions)}catch(u){throw this._sinkCount-=1,u}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let o=this._isTerminal;if(this._sinkCount===1&&!o)try{this._activate()}catch(u){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof i=="function")try{i()}catch{}throw u}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let a=!1;return()=>{a||(a=!0,this._sinkCount-=1,this._removeSink(e),typeof i=="function"&&i(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[n]=this._sinks;this._sinks=n}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,n=0;try{for(let t=0;t<e;t++){let s=t,i=this._deps[t];i.unsub=Oe,i.unsub=i.node.subscribe(o=>{if(i.unsub===null)return;let a=this._config.tierOf,u=!1;for(let d of o)a(d[0])>=3&&(u=!0),this._config.onMessage(this,d,{direction:"down-in",depIndex:s},this._actions);u&&this._maybeRunFnOnSettlement()}),n++}}catch(t){this._deps[n].unsub=null;for(let s=0;s<n;s++){let i=this._deps[s];if(i.unsub!=null){let o=i.unsub;i.unsub=null;try{o()}catch{}me(i)}}throw this._dirtyDepCount=0,t}}_addDep(e){for(let s=0;s<this._deps.length;s++)if(this._deps[s].node===e)return s;let n=this._deps.length,t=De(e);if(this._deps.push(t),this._sinks==null)return n;t.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(he),t.unsub=Oe;try{t.unsub=e.subscribe(s=>{if(t.unsub===null)return;let i=this._config.tierOf,o=!1;for(let a of s)i(a[0])>=3&&(o=!0),this._config.onMessage(this,a,{direction:"down-in",depIndex:n},this._actions);o&&this._maybeRunFnOnSettlement()})}catch(s){throw t.unsub=null,this._deps.pop(),this._dirtyDepCount--,s}return n}_deactivate(e=!1){let n=this._cleanup;if(this._cleanup=void 0,typeof n=="function")try{n()}catch(t){this._emit([[T,this._wrapFnError("cleanup threw",t)]])}else if(n!=null&&typeof n=="object"){let t=n.deactivate;if(typeof t=="function")try{t()}catch(s){this._emit([[T,this._wrapFnError("cleanup.deactivate threw",s)]])}}for(let t of this._deps){if(t.unsub!=null){let s=t.unsub;t.unsub=null;try{s()}catch{}}me(t)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,n){let t=this._deps[e],s=n[0];if(this._inspectorHooks!=null){let i={kind:"dep_message",depIndex:e,message:n};for(let o of this._inspectorHooks)o(i)}if(s!==W){if(s===x){this._depDirtied(t);return}if(s===I){if(this._depInvalidated(t),this._cached===void 0)return;this._emit(Ne);return}if(s===D||s===$){this._emit([n]);return}if(s===A){this._emit(pe);return}if(s===b)this._depSettledAsData(t,n[1]);else if(s===O)this._depSettledAsResolved(t);else if(s===C)this._depSettledAsTerminal(t,!0);else if(s===T)this._depSettledAsTerminal(t,n[1]);else{this._emit([n]);return}if(!this._fn){(s===b||s===O)&&this._emit([n]),(s===C||s===T)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(he))}_depSettledAsData(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(n),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=n,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(!this._partial&&!this._hasCalledFnOnce)for(let e=0;e<this._deps.length;e++){let n=this._deps[e];if(n.dataBatch.length===0&&n.prevData===void 0&&n.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(Me),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(n=>n.terminal!==void 0&&n.terminal!==!0);if(e!=null){this._autoError&&this._emit([[T,e.terminal]]);return}this._autoComplete&&this._deps.every(n=>n.terminal!==void 0)&&this._emit(Ae)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(o){this._emit([[T,this._wrapFnError("cleanup threw",o)]]);return}}else if(e!=null&&typeof e=="object"){let o=e.beforeRun;if(typeof o=="function"){e.beforeRun=void 0;try{o()}catch(a){this._emit([[T,this._wrapFnError("cleanup.beforeRun threw",a)]]);return}}}let n=this._deps.map(o=>o.involvedThisWave?o.dataBatch.length>0?[...o.dataBatch]:[]:void 0),t=this._deps.map(o=>o.prevData);for(let o=0;o<this._deps.length;o++){let a=n[o];a!=null&&a.length>0&&(this._deps[o].prevData=a[a.length-1])}let s=this._deps.map(o=>o.terminal),i={prevData:t,terminalDeps:s,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let o={kind:"run",batchData:n,prevData:t};for(let a of this._inspectorHooks)a(o)}this._isExecutingFn=!0;try{let o=this._fn(n,this._actions,i);if(typeof o=="function")this._cleanup=o;else if(o!=null&&typeof o=="object"){let a=o;(typeof a.beforeRun=="function"||typeof a.deactivate=="function"||typeof a.invalidate=="function")&&(this._cleanup=o)}}catch(o){this._emit([[T,this._wrapFnError("fn threw",o)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>Ie?(this._rerunDepth=0,this._emit([[T,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${Ie} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,n){let t=n instanceof Error?n.message:String(n);return new Error(`Node "${this.name}": ${e}: ${t}`,{cause:n})}_frameBatch(e){let n=this._config.tierOf;if(e.length===1)return n(e[0][0])===3&&this._status!=="dirty"?[F,e[0]]:e;let t=!0,s=!1,i=!1,o=-1;for(let u of e){let d=n(u[0]);d<o&&(t=!1),d===3&&(s=!0),u[0]===x&&(i=!0),o=d}let a=e;if(!t){let u=e.map((d,f)=>({m:d,i:f,tier:n(d[0])}));u.sort((d,f)=>d.tier-f.tier||d.i-f.i),a=u.map(d=>d.m)}if(s&&!i&&this._status!=="dirty"){let u=0;for(;u<a.length&&n(a[u][0])===0;)u++;return u===0?[F,...a]:[...a.slice(0,u),F,...a.slice(u)]}return a}_emit(e){if(e.length===0)return;for(let a=0;a<e.length;a++){let u=e[a];if(u[0]===T&&u[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let n=e;if(this._isTerminal&&!this._resubscribable){let a=e.filter(u=>u[0]===A||u[0]===I);if(a.length===0)return;n=a}n=this._frameBatch(n);let s=null;for(let a=0;a<n.length;a++){let u=n[a],d=u[0];if(d!==D&&d!==$){s?.push(u);continue}if(u.length<2)throw new Error(`Node "${this.name}": [[${d===D?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let f=!0;if(this._pausable!==!1){let y=u[1];if(d===D)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(y),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(y))f=!1;else if(this._pauseLocks.delete(y),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let p=this._pauseBuffer;this._pauseBuffer=[],this._emit(p)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}f?s?.push(u):s==null&&(s=n.slice(0,a))}if(s!=null){if(s.length===0)return;n=s}if(this._hasMeta&&n.some(a=>a[0]===A))for(let a of Object.keys(this.meta))try{this.meta[a]._emit(pe)}catch{}let{finalMessages:i,equalsError:o}=this._updateState(n);if(i.length>0&&this._config.inspectorEnabled){let a=this._config.globalInspector;if(a!=null)try{a({kind:"emit",node:this,messages:i})}catch{}}if(i.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let a=this._config.tierOf,u=[];for(let d of i)a(d[0])===3?this._pauseBuffer.push(d):u.push(d);u.length>0&&this._dispatchOrAccumulate(u)}else this._dispatchOrAccumulate(i);o!=null&&this._emit([[T,o]])}_updateState(e){let n=this._config.tierOf,t,s,i=-1,o=0;for(let f of e)n(f[0])===3&&o++;let a=o<=1,u=-1;if(this._versioning!=null&&o>1){for(let f=e.length-1;f>=0;f--)if(e[f][0]===b){u=f;break}}for(let f=0;f<e.length;f++){let y=e[f],p=y[0];if(p===b){if(y.length>=2){let c=!1;if(a&&this._cached!==void 0)try{c=this._equals(this._cached,y[1])}catch(l){s=this._wrapFnError("equals threw",l),i=f;break}if(c){t==null&&(t=e.slice(0,f)),t.push(ce),this._status="resolved";continue}this._cached=y[1],this._versioning!=null&&(u<0||f===u)&&Ve(this._versioning,y[1],this._hashFn)}this._status="settled",t?.push(y)}else if(t?.push(y),p===x)this._status="dirty";else if(p===O)this._status="resolved";else if(p===C)this._status="completed";else if(p===T)this._status="errored";else if(p===I){this._cached=void 0,this._status="dirty";let c=this._cleanup;if(typeof c=="function"){this._cleanup=void 0;try{c()}catch{}}else if(c!=null&&typeof c=="object"){let l=c.invalidate;if(typeof l=="function")try{l()}catch{}}}else p===A&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let d=i>=0?t??e.slice(0,i):t??e;return s!=null?{finalMessages:d,equalsError:s}:{finalMessages:d}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let n=[...this._sinks];for(let t of n)t(e)};_dispatchOrAccumulate(e){if(Te()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],ke(()=>this._flushBatchPending()));for(let n of e)this._batchPendingMessages.push(n);return}Z(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let n=this._frameBatch(e);Z(this._deliverToSinks,n,this._config.tierOf)}},Ce=r=>Array.isArray(r),be=r=>typeof r=="object"&&r!=null&&!Array.isArray(r);function we(r,e,n){let t=Ce(r)?r:[],s=typeof r=="function"?r:typeof e=="function"?e:void 0,i={};return Ce(r)?i=(be(e)?e:n)??{}:be(r)?i=r:i=(be(e)?e:n)??{},new te(t,s,i)}function E(r,e){return we([],{...e,initial:r})}function q(r,e,n){return we(r,(s,i,o)=>{let a=s.map((u,d)=>u!=null&&u.length>0?u.at(-1):o.prevData[d]);i.emit(e(a,o))},{describeKind:"derived",...n})}function Ke(r,e){if(r===e)return 0;let n=typeof r;if(n===typeof e&&(n==="number"||n==="string"||n==="boolean"||n==="bigint")){let s=r,i=e;return s<i?-1:s>i?1:0}return String(r).localeCompare(String(e))}function on(r,e){let n=Ke(r[0],e[0]);return n!==0?n:Ke(r[1],e[1])}function ze(r){return[r.secondary,r.primary]}function G(r,e){let n=ze(e),t=0,s=r.length;for(;t<s;){let i=t+s>>1;on(n,ze(r[i]))>0?t=i+1:s=i}return t}var re=class{_version=0;_buf=[];_byPrimary=new Map;get version(){return this._version}get size(){return this._buf.length}has(e){return this._byPrimary.has(e)}get(e){return this._byPrimary.get(e)?.value}upsert(e,n,t,s){let i=this._byPrimary.get(e),o={primary:e,secondary:n,value:t};if(i!==void 0&&s?.equals?.(i,o))return!1;if(i!==void 0){let u=G(this._buf,i);this._buf.splice(u,1)}let a=G(this._buf,o);return this._buf.splice(a,0,o),this._byPrimary.set(e,o),this._version+=1,i===void 0}upsertMany(e,n){let t=0;try{for(let s of e){let i=this._byPrimary.get(s.primary),o={primary:s.primary,secondary:s.secondary,value:s.value};if(i!==void 0&&n?.equals?.(i,o))continue;if(i!==void 0){let u=G(this._buf,i);this._buf.splice(u,1)}let a=G(this._buf,o);this._buf.splice(a,0,o),this._byPrimary.set(s.primary,o),t+=1}}finally{t>0&&(this._version+=1)}return t}delete(e){let n=this._byPrimary.get(e);if(n===void 0)return!1;let t=G(this._buf,n);return this._buf.splice(t,1),this._byPrimary.delete(e),this._version+=1,!0}deleteMany(e){let n=0;try{for(let t of e){let s=this._byPrimary.get(t);if(s===void 0)continue;let i=G(this._buf,s);this._buf.splice(i,1),this._byPrimary.delete(t),n+=1}}finally{n>0&&(this._version+=1)}return n}clear(){let e=this._buf.length;return e===0?0:(this._buf.length=0,this._byPrimary.clear(),this._version+=1,e)}toArray(){return[...this._buf]}toPrimaryMap(){let e=new Map;for(let n of this._buf)e.set(n.primary,n.value);return e}};function an(r){return r.subscribe(()=>{})}function dn(r={}){let{name:e,versioning:n,equals:t,backend:s}=r,i=s??new re;function o(c){return c?.equals!==void 0||t===void 0?c:{...c,equals:t}}let a=E([],{name:e,describeKind:"state",equals:(c,l)=>c===l,...n!=null?{versioning:n}:{}}),u=q([a],([c])=>{let l=c,h=new Map;for(let _ of l)h.set(_.primary,_.value);return h},{initial:i.toPrimaryMap(),describeKind:"derived"}),d=an(u),f=!1;function y(){let c=i.toArray();N(()=>{a.down([[x]]),a.down([[b,c]])})}function p(c){let l=i.version;try{return c()}finally{i.version!==l&&y()}}return{ordered:a,byPrimary:u,has(c){return i.has(c)},get(c){return i.get(c)},get size(){return i.size},upsert(c,l,h,_){return p(()=>i.upsert(c,l,h,o(_)))},upsertMany(c,l){let h=[...c];h.length!==0&&p(()=>i.upsertMany(h,o(l)))},delete(c){p(()=>i.delete(c))},deleteMany(c){let l=[...c];l.length!==0&&p(()=>i.deleteMany(l))},clear(){p(()=>i.clear())},dispose(){f||(f=!0,d())}}}var se=class{_version=0;_buf;constructor(e){this._buf=e?[...e]:[]}get version(){return this._version}get size(){return this._buf.length}at(e){if(!Number.isInteger(e))return;let n=e>=0?e:this._buf.length+e;if(!(n<0||n>=this._buf.length))return this._buf[n]}append(e){this._buf.push(e),this._version+=1}appendMany(e){if(e.length===0)return;let n=this._buf.length;this._buf.length=n+e.length;for(let t=0;t<e.length;t++)this._buf[n+t]=e[t];this._version+=1}insert(e,n){if(!Number.isInteger(e)||e<0||e>this._buf.length)throw new RangeError(`insert: index ${e} out of range [0, ${this._buf.length}]`);this._buf.splice(e,0,n),this._version+=1}insertMany(e,n){if(!Number.isInteger(e)||e<0||e>this._buf.length)throw new RangeError(`insertMany: index ${e} out of range [0, ${this._buf.length}]`);n.length!==0&&(this._buf.splice(e,0,...n),this._version+=1)}pop(e){if(this._buf.length===0)throw new RangeError("pop from empty list");if(!Number.isInteger(e))throw new RangeError(`pop: index ${e} must be an integer`);let n=e>=0?e:this._buf.length+e;if(n<0||n>=this._buf.length)throw new RangeError(`pop: index ${e} out of range`);let[t]=this._buf.splice(n,1);return this._version+=1,t}clear(){let e=this._buf.length;return e===0?0:(this._buf.length=0,this._version+=1,e)}toArray(){return[...this._buf]}};function un(r,e={}){let{name:n,versioning:t,backend:s}=e,i=s??new se(r),o=E(i.toArray(),{name:n,describeKind:"state",equals:(d,f)=>d===f,...t!=null?{versioning:t}:{}});function a(){let d=i.toArray();N(()=>{o.down([[x]]),o.down([[b,d]])})}function u(d){let f=i.version;try{return d()}finally{i.version!==f&&a()}}return{items:o,get size(){return i.size},at(d){return i.at(d)},append(d){u(()=>i.append(d))},appendMany(d){u(()=>i.appendMany(d))},insert(d,f){u(()=>i.insert(d,f))},insertMany(d,f){u(()=>i.insertMany(d,f))},pop(d=-1){return u(()=>i.pop(d))},clear(){u(()=>i.clear())},dispose(){}}}var ie=class{_version=0;_maxSize;_buf;_head=0;_size=0;constructor(e,n){if(n!==void 0&&n<1)throw new RangeError("maxSize must be >= 1");if(this._maxSize=n,n!==void 0){if(this._buf=new Array(n),e&&e.length>0){let t=Math.min(e.length,n),s=e.length-t;for(let i=0;i<t;i++)this._buf[i]=e[s+i];this._size=t}}else this._buf=e?[...e]:[],this._size=this._buf.length}get version(){return this._version}get size(){return this._size}at(e){if(!Number.isInteger(e))return;let n=e>=0?e:this._size+e;if(!(n<0||n>=this._size))return this._maxSize!==void 0?this._buf[(this._head+n)%this._maxSize]:this._buf[n]}append(e){this._rawAppend(e),this._version+=1}appendMany(e){if(e.length===0)return;let n=this._maxSize!==void 0&&e.length>this._maxSize?e.length-this._maxSize:0;for(let t=n;t<e.length;t++)this._rawAppend(e[t]);this._version+=1}clear(){if(this._size===0)return 0;let e=this._size;if(this._maxSize===void 0)this._buf.length=0;else for(let n=0;n<e;n++)this._buf[(this._head+n)%this._maxSize]=void 0;return this._head=0,this._size=0,this._version+=1,e}trimHead(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`trimHead: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return 0;let n=Math.min(e,this._size);if(this._maxSize===void 0)this._buf.splice(0,n);else{for(let t=0;t<n;t++)this._buf[(this._head+t)%this._maxSize]=void 0;this._head=(this._head+n)%this._maxSize}return this._size-=n,this._version+=1,n}slice(e,n){if(!Number.isInteger(e)||e<0)throw new RangeError(`slice: start must be a non-negative integer (got ${e})`);if(n!==void 0&&(!Number.isInteger(n)||n<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${n})`);let t=n===void 0?this._size:Math.min(Math.max(n,0),this._size),s=Math.min(e,this._size);if(s>=t)return[];let i=t-s;if(this._maxSize===void 0)return this._buf.slice(s,t);let o=new Array(i);for(let a=0;a<i;a++)o[a]=this._buf[(this._head+s+a)%this._maxSize];return o}tail(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`tail: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return[];let n=Math.min(e,this._size);return this.slice(this._size-n,this._size)}toArray(){if(this._maxSize===void 0)return[...this._buf];let e=new Array(this._size);for(let n=0;n<this._size;n++)e[n]=this._buf[(this._head+n)%this._maxSize];return e}_rawAppend(e){if(this._maxSize===void 0){this._buf.push(e),this._size=this._buf.length;return}this._size<this._maxSize?(this._buf[(this._head+this._size)%this._maxSize]=e,this._size+=1):(this._buf[this._head]=e,this._head=(this._head+1)%this._maxSize)}};function Fe(r){return r.subscribe(()=>{})}var ln=64;function cn(r,e={}){let{name:n,maxSize:t,versioning:s,backend:i}=e,o=i??new ie(r,t),a=E(o.toArray(),{name:n,describeKind:"state",equals:(l,h)=>l===h,...s!=null?{versioning:s}:{}});function u(){let l=o.toArray();N(()=>{a.down([[x]]),a.down([[b,l]])})}let d=new Map,f=new Map;function y(l,h){return`${l}:${h===void 0?"END":h}`}function p(l){if(l.size<ln)return;let h=l.keys().next();if(h.done)return;let _=l.get(h.value);_!==void 0&&_.dispose(),l.delete(h.value)}function c(l){let h=o.version;try{return l()}finally{o.version!==h&&u()}}return{entries:a,get size(){return o.size},at(l){return o.at(l)},append(l){c(()=>o.append(l))},appendMany(l){l.length!==0&&c(()=>o.appendMany(l))},clear(){c(()=>o.clear())},trimHead(l){c(()=>o.trimHead(l))},tail(l){if(!Number.isInteger(l)||l<0)throw new RangeError(`tail: n must be a non-negative integer (got ${l})`);let h=d.get(l);if(h!==void 0)return d.delete(l),d.set(l,h),h.node;p(d);let _=q([a],([m])=>{let v=m;return l===0||v.length===0?[]:v.slice(Math.max(0,v.length-l))},{initial:o.tail(l),describeKind:"derived"}),g=Fe(_);return d.set(l,{node:_,dispose:g}),_},slice(l,h){if(!Number.isInteger(l)||l<0)throw new RangeError(`slice: start must be a non-negative integer (got ${l})`);if(h!==void 0&&(!Number.isInteger(h)||h<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${h})`);let _=y(l,h),g=f.get(_);if(g!==void 0)return f.delete(_),f.set(_,g),g.node;p(f);let m=q([a],([R])=>{let k=R;return h===void 0?k.slice(l):k.slice(l,h)},{initial:o.slice(l,h),describeKind:"derived"}),v=Fe(m);return f.set(_,{node:m,dispose:v}),m},disposeTail(l){let h=d.get(l);return h===void 0?!1:(h.dispose(),d.delete(l),!0)},disposeSlice(l,h){let _=y(l,h),g=f.get(_);return g===void 0?!1:(g.dispose(),f.delete(_),!0)},disposeAllViews(){for(let l of d.values())l.dispose();d.clear();for(let l of f.values())l.dispose();f.clear()},dispose(){for(let l of d.values())l.dispose();d.clear();for(let l of f.values())l.dispose();f.clear()}}}var oe=class{_version=0;_store=new Map;_maxSize;_defaultTtl;constructor(e={}){let{maxSize:n,defaultTtl:t}=e;if(n!==void 0&&n<1)throw new RangeError("maxSize must be >= 1");if(t!==void 0&&t<=0)throw new RangeError("defaultTtl must be positive");this._maxSize=n,this._defaultTtl=t}get version(){return this._version}get size(){return this._store.size}has(e){let n=this._store.get(e);return n===void 0?!1:this._isExpired(n)?(this._store.delete(e),this._version+=1,!1):(this._touchLru(e,n),!0)}get(e){let n=this._store.get(e);if(n!==void 0){if(this._isExpired(n)){this._store.delete(e),this._version+=1;return}return this._touchLru(e,n),n.value}}set(e,n,t){let s=this._resolveExpiresAt(t);this._store.has(e)&&this._store.delete(e),this._store.set(e,{value:n,expiresAt:s}),this._evictLruWhileOver(),this._version+=1}setMany(e,n){let t=this._resolveExpiresAt(n),s=0;try{for(let[i,o]of e)this._store.has(i)&&this._store.delete(i),this._store.set(i,{value:o,expiresAt:t}),s+=1}finally{s>0&&(this._evictLruWhileOver(),this._version+=1)}}delete(e){let n=this._store.delete(e);return n&&(this._version+=1),n}deleteMany(e){let n=0;try{for(let t of e)this._store.delete(t)&&(n+=1)}finally{n>0&&(this._version+=1)}return n}clear(){let e=this._store.size;return e===0?0:(this._store.clear(),this._version+=1,e)}pruneExpired(){let e=j(),n=0;for(let[t,s]of this._store)this._isExpired(s,e)&&(this._store.delete(t),n+=1);return n>0&&(this._version+=1),n}toMap(){let e=j(),n=new Map;for(let[t,s]of this._store)this._isExpired(s,e)||n.set(t,s.value);return n}_resolveExpiresAt(e){let n=e??this._defaultTtl;if(n!==void 0){if(!Number.isFinite(n)||n<=0)throw new RangeError(`MapBackend: ttl must be a positive finite number (got ${n})`);return j()+n*1e9}}_isExpired(e,n){return e.expiresAt===void 0?!1:(n??j())>=e.expiresAt}_touchLru(e,n){this._store.delete(e),this._store.set(e,n)}_evictLruWhileOver(){if(this._maxSize!==void 0)for(;this._store.size>this._maxSize;){let e=this._store.keys().next().value;if(e===void 0)break;this._store.delete(e)}}};function fn(r={}){let{name:e,maxSize:n,defaultTtl:t,versioning:s,backend:i,retention:o}=r;if(o&&n!==void 0)throw new RangeError("reactiveMap: `maxSize` (LRU) and `retention` (score-based) are mutually exclusive. Pick one eviction policy.");if(o&&o.archiveThreshold===void 0&&o.maxSize===void 0)throw new RangeError("reactiveMap: `retention` requires at least one of `archiveThreshold` or `maxSize` to trigger archival.");let a=i??new oe({maxSize:n,defaultTtl:t}),u=E(a.toMap(),{name:e,describeKind:"state",equals:(p,c)=>p===c,...s!=null?{versioning:s}:{}});function d(){let p=a.toMap();N(()=>{u.down([[x]]),u.down([[b,p]])})}function f(){if(!o)return;let p=a.toMap(),c=o.archiveThreshold,l=o.maxSize,h=[];for(let[g,m]of p)h.push({key:g,value:m,score:o.score(g,m)});h.sort((g,m)=>g.score-m.score);let _=new Set;if(c!==void 0)for(let g of h)if(g.score<c)_.add(g.key);else break;if(l!==void 0&&h.length-_.size>l)for(let g of h){if(h.length-_.size<=l)break;_.has(g.key)||_.add(g.key)}if(_.size!==0)for(let g of h)_.has(g.key)&&(o.onArchive?.(g.key,g.value,g.score),a.delete(g.key))}function y(p,c="mutation"){let l=a.version;try{return p()}finally{a.version!==l&&(c==="mutation"&&f(),d())}}return{entries:u,has(p){return y(()=>a.has(p),"read")},get(p){return y(()=>a.get(p),"read")},set(p,c,l){y(()=>a.set(p,c,l?.ttl))},setMany(p,c){y(()=>a.setMany(p,c?.ttl))},delete(p){y(()=>a.delete(p))},deleteMany(p){y(()=>a.deleteMany(p))},clear(){y(()=>a.clear())},pruneExpired(){y(()=>a.pruneExpired())},get size(){return a.size},dispose(){}}}0&&(module.exports={NativeIndexBackend,NativeListBackend,NativeLogBackend,NativeMapBackend,reactiveIndex,reactiveList,reactiveLog,reactiveMap});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as Node, V as VersioningLevel } from '../node-BVV7G1bq.cjs';
|
|
2
2
|
export { L as LogBackend, N as NativeLogBackend, R as ReactiveLogBundle, a as ReactiveLogOptions, r as reactiveLog } from '../reactive-log-5jFeNRmd.cjs';
|
|
3
|
-
export { M as MapBackend, N as NativeMapBackend, b as NativeMapBackendOptions, R as ReactiveMapBundle, a as ReactiveMapOptions, r as reactiveMap } from '../reactive-map-
|
|
3
|
+
export { M as MapBackend, N as NativeMapBackend, b as NativeMapBackendOptions, R as ReactiveMapBundle, a as ReactiveMapOptions, c as ReactiveMapRetention, r as reactiveMap } from '../reactive-map-IJIfZxoh.cjs';
|
|
4
4
|
|
|
5
5
|
type IndexRow<K, V = unknown> = {
|
|
6
6
|
readonly primary: K;
|
package/dist/extra/reactive.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as Node, V as VersioningLevel } from '../node-BVV7G1bq.js';
|
|
2
2
|
export { L as LogBackend, N as NativeLogBackend, R as ReactiveLogBundle, a as ReactiveLogOptions, r as reactiveLog } from '../reactive-log-BOJDCI5x.js';
|
|
3
|
-
export { M as MapBackend, N as NativeMapBackend, b as NativeMapBackendOptions, R as ReactiveMapBundle, a as ReactiveMapOptions, r as reactiveMap } from '../reactive-map-
|
|
3
|
+
export { M as MapBackend, N as NativeMapBackend, b as NativeMapBackendOptions, R as ReactiveMapBundle, a as ReactiveMapOptions, c as ReactiveMapRetention, r as reactiveMap } from '../reactive-map-CtRaCddO.js';
|
|
4
4
|
|
|
5
5
|
type IndexRow<K, V = unknown> = {
|
|
6
6
|
readonly primary: K;
|
package/dist/extra/reactive.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as m,b as p}from"../chunk-
|
|
1
|
+
import{a as m,b as p}from"../chunk-DWIAG62L.js";import{a as t,b as x}from"../chunk-4UUDNFYG.js";import{a as e,b as f}from"../chunk-LWGLBCMU.js";import{a as o,b as r}from"../chunk-XRSHMHEG.js";import"../chunk-7AJKUA36.js";import"../chunk-CK2E7BTU.js";import"../chunk-QYADASLV.js";export{m as NativeIndexBackend,t as NativeListBackend,o as NativeLogBackend,e as NativeMapBackend,p as reactiveIndex,x as reactiveList,r as reactiveLog,f as reactiveMap};
|
package/dist/extra/sources.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ve=Object.defineProperty;var Ot=Object.getOwnPropertyDescriptor;var Mt=Object.getOwnPropertyNames;var Rt=Object.prototype.hasOwnProperty;var E=(t,e)=>()=>(t&&(e=t(t=0)),e);var Te=(t,e)=>{for(var n in e)ve(t,n,{get:e[n],enumerable:!0})},Ct=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Mt(e))!Rt.call(t,s)&&s!==n&&ve(t,s,{get:()=>e[s],enumerable:!(r=Ot(e,s))||r.enumerable});return t};var Dt=t=>Ct(ve({},"__esModule",{value:!0}),t);function V(){return Math.trunc(performance.now()*1e6)}function se(){return Date.now()*1e6}var ie=E(()=>{"use strict"});var J,b,v,w,C,D,X,S,_,p,H,xe,It,Ne,Ft,Lt,ke,Ue,We,$e,Ee,Z=E(()=>{"use strict";J=Symbol.for("graphrefly/START"),b=Symbol.for("graphrefly/DATA"),v=Symbol.for("graphrefly/DIRTY"),w=Symbol.for("graphrefly/RESOLVED"),C=Symbol.for("graphrefly/INVALIDATE"),D=Symbol.for("graphrefly/PAUSE"),X=Symbol.for("graphrefly/RESUME"),S=Symbol.for("graphrefly/TEARDOWN"),_=Symbol.for("graphrefly/COMPLETE"),p=Symbol.for("graphrefly/ERROR"),H=Object.freeze([v]),xe=Object.freeze([w]),It=Object.freeze([C]),Ne=Object.freeze([J]),Ft=Object.freeze([_]),Lt=Object.freeze([S]),ke=Object.freeze([H]),Ue=Object.freeze([xe]),We=Object.freeze([It]),$e=Object.freeze([Ft]),Ee=Object.freeze([Lt])});function je(t){t.registerCodec(Pt)}var Pt,ze=E(()=>{"use strict";Pt={name:"json",version:1,contentType:"application/json",encode(t){let e=JSON.stringify(t);return new TextEncoder().encode(e)},decode(t,e){let n=new TextDecoder().decode(t);return JSON.parse(n)}}});function ae(t){if(t==null)return Bt;let{type:e,id:n,...r}=t;return{type:e??"system",id:n??"",...r}}var Bt,qe=E(()=>{"use strict";Bt={type:"system",id:""}});function Ye(){return U>0||Q}function Ke(){return U>0}function Je(t){U>0?ee.push(t):t()}function Se(t){U+=1;let e=!1;try{t()}catch(n){throw e=!0,n}finally{if(U-=1,U===0)if(e){if(!Q){let n=ee.splice(0);for(let r of n)try{r()}catch{}I.length=0,F.length=0,W.length=0}}else Gt()}}function Gt(){let t=!Q;t&&(Q=!0);let e=[],n=0;try{for(;I.length>0||F.length>0||W.length>0||t&&ee.length>0;){if(t&&ee.length>0){let i=ee.splice(0);for(let o of i)try{o()}catch(a){e.push(a)}continue}if(n+=1,n>1e3)throw I.length=0,F.length=0,W.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let s=(I.length>0?I:F.length>0?F:W).splice(0);for(let i of s)try{i()}catch(o){e.push(o)}}}finally{t&&(Q=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function ue(t,e,n){if(e.length===0)return;if(e.length===1){let d=n(e[0][0]);if(d<3||!Ye()){t(e);return}(d>=5?W:d===4?F:I).push(()=>t(e));return}let r=e.length,s=r,i=r,o=r,a=0;for(;a<r&&n(e[a][0])<3;)a++;for(s=a;a<r&&n(e[a][0])===3;)a++;for(i=a;a<r&&n(e[a][0])===4;)a++;o=a;let u=Ye();if(s>0){let d=e.slice(0,s);t(d)}if(i>s){let d=e.slice(s,i);u?I.push(()=>t(d)):t(d)}if(o>i){let d=e.slice(i,o);u?F.push(()=>t(d)):t(d)}if(r>o){let d=e.slice(o,r);u?W.push(()=>t(d)):t(d)}}var U,Q,I,F,W,ee,Ae=E(()=>{"use strict";U=0,Q=!1,I=[],F=[],W=[],ee=[]});function Xe(t){t.registerMessageType(J,{tier:0,wireCrossing:!1}),t.registerMessageType(v,{tier:1,wireCrossing:!1}),t.registerMessageType(C,{tier:1,wireCrossing:!1,metaPassthrough:!1}),t.registerMessageType(D,{tier:2,wireCrossing:!1}),t.registerMessageType(X,{tier:2,wireCrossing:!1}),t.registerMessageType(b,{tier:3,wireCrossing:!0}),t.registerMessageType(w,{tier:3,wireCrossing:!0}),t.registerMessageType(_,{tier:4,wireCrossing:!0,metaPassthrough:!1}),t.registerMessageType(p,{tier:4,wireCrossing:!0,metaPassthrough:!1}),t.registerMessageType(S,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var de,Ze=E(()=>{"use strict";Z();de=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=n=>{let r=this._messageTypes.get(n);return r!=null?r.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}registerMessageType(e,n){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:n.tier,wireCrossing:n.wireCrossing??n.tier>=3,metaPassthrough:n.metaPassthrough??!0}),this}messageTier(e){let n=this._messageTypes.get(e);return n!=null?n.tier:1}isWireCrossing(e){let n=this._messageTypes.get(e);return n!=null?n.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let n=this._messageTypes.get(e);return n!=null?n.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}}});var $,Qe=E(()=>{"use strict";$=class extends Error{actor;action;nodeName;constructor(e,n){super(n??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}}});function Oe(t){if(t===void 0)return null;if(typeof t=="number"){if(!Number.isFinite(t))throw new TypeError(`Cannot hash non-finite number: ${t}`);if(Number.isInteger(t)&&!Number.isSafeInteger(t))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${t}. Cross-language cid parity is not guaranteed for unsafe integers.`);return t}if(typeof t=="string"||typeof t=="boolean"||t===null)return t;if(Array.isArray(t))return t.map(Oe);if(typeof t=="object"&&t!==null){let e={};for(let n of Object.keys(t).sort())e[n]=Oe(t[n]);return e}return null}function Ut(t){let e=Ht.encode(t),n=e.length,r=n*8,s=n+9+63&-64,i=new Uint8Array(s);i.set(e),i[n]=128;let o=new DataView(i.buffer);o.setUint32(s-4,r>>>0,!1),o.setUint32(s-8,Math.floor(r/4294967296)>>>0,!1);let a=1779033703,u=3144134277,d=1013904242,c=2773480762,l=1359893119,f=2600822924,y=528734635,T=1541459225,g=new Uint32Array(64),m=(x,O)=>x>>>O|x<<32-O;for(let x=0;x<s;x+=64){for(let k=0;k<16;k++)g[k]=o.getUint32(x+k*4,!1);for(let k=16;k<64;k++){let Y=g[k-15],K=g[k-2],oe=m(Y,7)^m(Y,18)^Y>>>3,we=m(K,17)^m(K,19)^K>>>10;g[k]=g[k-16]+oe+g[k-7]+we>>>0}let O=a,z=u,q=d,_e=c,R=l,ne=f,re=y,ye=T;for(let k=0;k<64;k++){let Y=m(R,6)^m(R,11)^m(R,25),K=R&ne^~R&re,oe=ye+Y+K+Vt[k]+g[k]>>>0,we=m(O,2)^m(O,13)^m(O,22),St=O&z^O&q^z&q,At=we+St>>>0;ye=re,re=ne,ne=R,R=_e+oe>>>0,_e=q,q=z,z=O,O=oe+At>>>0}a=a+O>>>0,u=u+z>>>0,d=d+q>>>0,c=c+_e>>>0,l=l+R>>>0,f=f+ne>>>0,y=y+re>>>0,T=T+ye>>>0}let h=x=>x.toString(16).padStart(8,"0");return h(a)+h(u)+h(d)+h(c)+h(l)+h(f)+h(y)+h(T)}function Me(t){let e=Oe(t??null),n=JSON.stringify(e);return Ut(n).slice(0,16)}function Wt(){let t=globalThis.crypto;if(t?.randomUUID)return t.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),n=e()+e()+e()+e();return`${n.slice(0,8)}-${n.slice(8,12)}-4${n.slice(13,16)}-${(parseInt(n.slice(16,17),16)&3|8).toString(16)}${n.slice(17,20)}-${n.slice(20,32)}`}function Re(t,e,n){let r=n?.id??Wt();if(t===0)return{id:r,version:0};let i=(n?.hash??Me)(e);return{id:r,version:0,cid:i,prev:null}}function et(t,e,n){t.version+=1,"cid"in t&&(t.prev=t.cid,t.cid=n(e))}var Vt,Ht,tt=E(()=>{"use strict";Vt=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ht=new TextEncoder});function ot(t){return{node:t,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function Ce(t){t.prevData=void 0,t.dirty=!1,t.involvedThisWave=!1,t.dataBatch.length=0,t.terminal=void 0}function ce(t){return t.length===0?t:typeof t[0]=="symbol"?[t]:t}function M(t,e,n){let r=st(t)?t:[],s=typeof t=="function"?t:typeof e=="function"?e:void 0,i={};return st(t)?i=(De(e)?e:n)??{}:De(t)?i=t:i=(De(e)?e:n)??{},new le(r,s,i)}var nt,rt,$t,jt,Ie,le,st,De,fe=E(()=>{"use strict";ze();qe();Ae();ie();Ze();Qe();Z();tt();nt=()=>{},rt=100;$t=(t,e,n,r)=>{n.direction==="down-in"&&t._onDepMessage(n.depIndex,e)},jt=(t,e,n,r)=>{let s=t;if(s._status==="completed"||s._status==="errored")return;let i=s._cached,o=i===void 0?[Ne]:[Ne,[b,i]];s._status==="dirty"&&o.push(H),ue(e,o,s._config.tierOf)},Ie=new de({onMessage:$t,onSubscribe:jt});Xe(Ie);je(Ie);le=class t{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,n,r){this._config=r.config??Ie,this._config.onMessage,this._optsName=r.name,this._describeKind=r.describeKind,this._equals=r.equals??Object.is,this._resubscribable=r.resubscribable??!1,this._resetOnTeardown=r.resetOnTeardown??!1,this._autoComplete=r.completeWhenDepsComplete??!0,this._autoError=r.errorWhenDepsError??!0,this._pausable=r.pausable??!0,this._guard=r.guard,this._fn=n,this._partial=r.partial??!1,this._cached=r.initial!==void 0?r.initial:void 0,this._status=e.length===0&&n==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=r.versioningHash??this._config.defaultHashFn??Me;let s=r.versioning??this._config.defaultVersioning;this._versioningLevel=s,this._versioning=s!=null?Re(s,this._cached===void 0?void 0:this._cached,{id:r.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(ot);let i={};for(let[a,u]of Object.entries(r.meta??{})){let d={initial:u,name:`${r.name??"node"}:meta:${a}`,describeKind:"state",config:this._config};r.guard!=null&&(d.guard=r.guard),i[a]=new t([],void 0,d)}Object.freeze(i),this.meta=i,this._hasMeta=Object.keys(i).length>0;let o=this;this._actions={emit(a){o._emit([[b,a]])},down(a){o._emit(ce(a))},up(a){o._emitUp(ce(a))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,n){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let r=this._versioningLevel;if(r!=null&&e<=r)return;let s=n?.hash??this._hashFn;s!==this._hashFn&&(this._hashFn=s);let i=this._cached===void 0?void 0:this._cached,o=this._versioning,a=o?.id??n?.id,u=o?.version??0,d=Re(e,i,{id:a,hash:s});d.version=u,this._versioning=d,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let n=ae(e);if(this._guard!=null&&!this._guard(n,"observe"))return!1;if(this._extraGuards!=null){for(let r of this._extraGuards)if(!r(n,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let n=this._guard!=null||this._extraGuards!=null,r=e?.actor!=null;if(!n&&!r)return;let s=ae(e?.actor),i=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(s,i))throw new $({actor:s,action:i,nodeName:this.name});if(this._extraGuards!=null){for(let o of this._extraGuards)if(!o(s,i))throw new $({actor:s,action:i,nodeName:this.name})}this._lastMutation={actor:s,timestamp_ns:se()}}down(e,n){let r=ce(e);r.length!==0&&(this._checkGuard(n),this._emit(r))}emit(e,n){this._checkGuard(n),this._emit([[b,e]])}up(e,n){if(this._deps.length===0)return;let r=ce(e);if(r.length===0)return;this._checkGuard(n);let s=n??{internal:!0};this._validateUpTiers(r);for(let i of this._deps)i.node.up?.(r,s)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let n of this._deps)n.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let n=this._config.tierOf;for(let r of e){let s=n(r[0]);if(s===3||s===4)throw new Error(`Node "${this.name}": tier-${s} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,n){if(n!=null&&this._guard!=null){let u=ae(n);if(!this._guard(u,"observe"))throw new $({actor:u,action:"observe",nodeName:this.name})}let s=this._isTerminal&&this._resubscribable;if(s){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let u of this._deps)Ce(u);if(this._partial===!1){for(let u of this._deps)if(u.prevData!==void 0||u.dataBatch.length!==0||u.terminal!==void 0||u.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let i;try{i=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:s},this._actions)}catch(u){throw this._sinkCount-=1,u}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let o=this._isTerminal;if(this._sinkCount===1&&!o)try{this._activate()}catch(u){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof i=="function")try{i()}catch{}throw u}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let a=!1;return()=>{a||(a=!0,this._sinkCount-=1,this._removeSink(e),typeof i=="function"&&i(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[n]=this._sinks;this._sinks=n}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,n=0;try{for(let r=0;r<e;r++){let s=r,i=this._deps[r];i.unsub=nt,i.unsub=i.node.subscribe(o=>{if(i.unsub===null)return;let a=this._config.tierOf,u=!1;for(let d of o)a(d[0])>=3&&(u=!0),this._config.onMessage(this,d,{direction:"down-in",depIndex:s},this._actions);u&&this._maybeRunFnOnSettlement()}),n++}}catch(r){this._deps[n].unsub=null;for(let s=0;s<n;s++){let i=this._deps[s];if(i.unsub!=null){let o=i.unsub;i.unsub=null;try{o()}catch{}Ce(i)}}throw this._dirtyDepCount=0,r}}_addDep(e){for(let s=0;s<this._deps.length;s++)if(this._deps[s].node===e)return s;let n=this._deps.length,r=ot(e);if(this._deps.push(r),this._sinks==null)return n;r.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(ke),r.unsub=nt;try{r.unsub=e.subscribe(s=>{if(r.unsub===null)return;let i=this._config.tierOf,o=!1;for(let a of s)i(a[0])>=3&&(o=!0),this._config.onMessage(this,a,{direction:"down-in",depIndex:n},this._actions);o&&this._maybeRunFnOnSettlement()})}catch(s){throw r.unsub=null,this._deps.pop(),this._dirtyDepCount--,s}return n}_deactivate(e=!1){let n=this._cleanup;if(this._cleanup=void 0,typeof n=="function")try{n()}catch(r){this._emit([[p,this._wrapFnError("cleanup threw",r)]])}else if(n!=null&&typeof n=="object"){let r=n.deactivate;if(typeof r=="function")try{r()}catch(s){this._emit([[p,this._wrapFnError("cleanup.deactivate threw",s)]])}}for(let r of this._deps){if(r.unsub!=null){let s=r.unsub;r.unsub=null;try{s()}catch{}}Ce(r)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,n){let r=this._deps[e],s=n[0];if(this._inspectorHooks!=null){let i={kind:"dep_message",depIndex:e,message:n};for(let o of this._inspectorHooks)o(i)}if(s!==J){if(s===v){this._depDirtied(r);return}if(s===C){this._depInvalidated(r),this._emit(We);return}if(s===D||s===X){this._emit([n]);return}if(s===S){this._emit(Ee);return}if(s===b)this._depSettledAsData(r,n[1]);else if(s===w)this._depSettledAsResolved(r);else if(s===_)this._depSettledAsTerminal(r,!0);else if(s===p)this._depSettledAsTerminal(r,n[1]);else{this._emit([n]);return}if(!this._fn){(s===b||s===w)&&this._emit([n]),(s===_||s===p)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(ke))}_depSettledAsData(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(n),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=n,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(!this._partial&&!this._hasCalledFnOnce)for(let e=0;e<this._deps.length;e++){let n=this._deps[e];if(n.dataBatch.length===0&&n.prevData===void 0&&n.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(Ue),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(n=>n.terminal!==void 0&&n.terminal!==!0);if(e!=null){this._autoError&&this._emit([[p,e.terminal]]);return}this._autoComplete&&this._deps.every(n=>n.terminal!==void 0)&&this._emit($e)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(o){this._emit([[p,this._wrapFnError("cleanup threw",o)]]);return}}else if(e!=null&&typeof e=="object"){let o=e.beforeRun;if(typeof o=="function"){e.beforeRun=void 0;try{o()}catch(a){this._emit([[p,this._wrapFnError("cleanup.beforeRun threw",a)]]);return}}}let n=this._deps.map(o=>o.involvedThisWave?o.dataBatch.length>0?[...o.dataBatch]:[]:void 0),r=this._deps.map(o=>o.prevData);for(let o=0;o<this._deps.length;o++){let a=n[o];a!=null&&a.length>0&&(this._deps[o].prevData=a[a.length-1])}let s=this._deps.map(o=>o.terminal),i={prevData:r,terminalDeps:s,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let o={kind:"run",batchData:n,prevData:r};for(let a of this._inspectorHooks)a(o)}this._isExecutingFn=!0;try{let o=this._fn(n,this._actions,i);if(typeof o=="function")this._cleanup=o;else if(o!=null&&typeof o=="object"){let a=o;(typeof a.beforeRun=="function"||typeof a.deactivate=="function"||typeof a.invalidate=="function")&&(this._cleanup=o)}}catch(o){this._emit([[p,this._wrapFnError("fn threw",o)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>rt?(this._rerunDepth=0,this._emit([[p,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${rt} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,n){let r=n instanceof Error?n.message:String(n);return new Error(`Node "${this.name}": ${e}: ${r}`,{cause:n})}_frameBatch(e){let n=this._config.tierOf;if(e.length===1)return n(e[0][0])===3&&this._status!=="dirty"?[H,e[0]]:e;let r=!0,s=!1,i=!1,o=-1;for(let u of e){let d=n(u[0]);d<o&&(r=!1),d===3&&(s=!0),u[0]===v&&(i=!0),o=d}let a=e;if(!r){let u=e.map((d,c)=>({m:d,i:c,tier:n(d[0])}));u.sort((d,c)=>d.tier-c.tier||d.i-c.i),a=u.map(d=>d.m)}if(s&&!i&&this._status!=="dirty"){let u=0;for(;u<a.length&&n(a[u][0])===0;)u++;return u===0?[H,...a]:[...a.slice(0,u),H,...a.slice(u)]}return a}_emit(e){if(e.length===0)return;for(let a=0;a<e.length;a++){let u=e[a];if(u[0]===p&&u[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let n=e;if(this._isTerminal&&!this._resubscribable){let a=e.filter(u=>u[0]===S||u[0]===C);if(a.length===0)return;n=a}n=this._frameBatch(n);let s=null;for(let a=0;a<n.length;a++){let u=n[a],d=u[0];if(d!==D&&d!==X){s?.push(u);continue}if(u.length<2)throw new Error(`Node "${this.name}": [[${d===D?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let c=!0;if(this._pausable!==!1){let l=u[1];if(d===D)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(l),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(l))c=!1;else if(this._pauseLocks.delete(l),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let f=this._pauseBuffer;this._pauseBuffer=[],this._emit(f)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?s?.push(u):s==null&&(s=n.slice(0,a))}if(s!=null){if(s.length===0)return;n=s}if(this._hasMeta&&n.some(a=>a[0]===S))for(let a of Object.keys(this.meta))try{this.meta[a]._emit(Ee)}catch{}let{finalMessages:i,equalsError:o}=this._updateState(n);if(i.length>0&&this._config.inspectorEnabled){let a=this._config.globalInspector;if(a!=null)try{a({kind:"emit",node:this,messages:i})}catch{}}if(i.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let a=this._config.tierOf,u=[];for(let d of i)a(d[0])===3?this._pauseBuffer.push(d):u.push(d);u.length>0&&this._dispatchOrAccumulate(u)}else this._dispatchOrAccumulate(i);o!=null&&this._emit([[p,o]])}_updateState(e){let n=this._config.tierOf,r,s,i=-1,o=0;for(let c of e)n(c[0])===3&&o++;let a=o<=1,u=-1;if(this._versioning!=null&&o>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===b){u=c;break}}for(let c=0;c<e.length;c++){let l=e[c],f=l[0];if(f===b){if(l.length>=2){let y=!1;if(a&&this._cached!==void 0)try{y=this._equals(this._cached,l[1])}catch(T){s=this._wrapFnError("equals threw",T),i=c;break}if(y){r==null&&(r=e.slice(0,c)),r.push(xe),this._status="resolved";continue}this._cached=l[1],this._versioning!=null&&(u<0||c===u)&&et(this._versioning,l[1],this._hashFn)}this._status="settled",r?.push(l)}else if(r?.push(l),f===v)this._status="dirty";else if(f===w)this._status="resolved";else if(f===_)this._status="completed";else if(f===p)this._status="errored";else if(f===C){this._cached=void 0,this._status="dirty";let y=this._cleanup;if(typeof y=="function"){this._cleanup=void 0;try{y()}catch{}}else if(y!=null&&typeof y=="object"){let T=y.invalidate;if(typeof T=="function")try{T()}catch{}}}else f===S&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let d=i>=0?r??e.slice(0,i):r??e;return s!=null?{finalMessages:d,equalsError:s}:{finalMessages:d}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let n=[...this._sinks];for(let r of n)r(e)};_dispatchOrAccumulate(e){if(Ke()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Je(()=>this._flushBatchPending()));for(let n of e)this._batchPendingMessages.push(n);return}ue(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let n=this._frameBatch(e);ue(this._deliverToSinks,n,this._config.tierOf)}},st=t=>Array.isArray(t),De=t=>typeof t=="object"&&t!=null&&!Array.isArray(t)});function it(t,e){return M([],{...e,initial:t})}function N(t,e){return M((r,s,i)=>t(s,i)??void 0,{describeKind:"producer",...e})}var Fe=E(()=>{"use strict";fe()});function te(t,e,n){let r=new Set;for(let s of t.split(",")){let[i,o]=s.split("/"),a=o?Number.parseInt(o,10):1;if(Number.isNaN(a)||a<1)throw new Error(`Invalid cron step: ${s}`);let u,d;if(i==="*")u=e,d=n;else if(i.includes("-")){let[c,l]=i.split("-");u=Number.parseInt(c,10),d=Number.parseInt(l,10)}else u=Number.parseInt(i,10),d=u;if(Number.isNaN(u)||Number.isNaN(d))throw new Error(`Invalid cron field: ${t}`);if(u<e||d>n)throw new Error(`Cron field out of range: ${t} (${e}-${n})`);if(u>d)throw new Error(`Invalid cron range: ${u}-${d} in ${t}`);for(let c=u;c<=d;c+=a)r.add(c)}return r}function at(t){let e=t.trim().split(/\s+/);if(e.length!==5)throw new Error(`Invalid cron: expected 5 fields, got ${e.length}`);return{minutes:te(e[0],0,59),hours:te(e[1],0,23),daysOfMonth:te(e[2],1,31),months:te(e[3],1,12),daysOfWeek:te(e[4],0,6)}}function ut(t,e){return t.minutes.has(e.getMinutes())&&t.hours.has(e.getHours())&&t.daysOfMonth.has(e.getDate())&&t.months.has(e.getMonth()+1)&&t.daysOfWeek.has(e.getDay())}var dt=E(()=>{"use strict"});var mt={};Te(mt,{NS_PER_MS:()=>P,NS_PER_SEC:()=>j,constant:()=>ct,decorrelatedJitter:()=>ht,exponential:()=>ft,fibonacci:()=>pt,linear:()=>lt,resolveBackoffPreset:()=>pe,withMaxAttempts:()=>Yt});function L(t){return t<0?0:t}function zt(t,e){return e==="none"?t:e==="full"?Math.random()*t:t/2+Math.random()*(t/2)}function qt(t,e){return t+Math.random()*(e-t)}function ct(t){let e=L(t);return()=>e}function lt(t,e){let n=L(t),r=e===void 0?n:L(e);return s=>n+r*Math.max(0,s)}function ft(t){let e=L(t?.baseNs??1e8),n=t?.factor!==void 0&&t.factor<1?1:t?.factor??2,r=L(t?.maxDelayNs??30*1e9),s=t?.jitter??"none";return i=>{let o;if(e===0)o=0;else if(n===1)o=e;else{let a=r/e,u=1;for(let d=0;d<Math.max(0,i);d++){if(u>=a){u=a;break}u*=n}o=e*u,o>r&&(o=r)}return zt(o,s)}}function pt(t=100*1e6,e=30*1e9){let n=L(t),r=L(e);function s(i){if(i<=0)return 1;let o=1,a=2;for(let u=1;u<i;u++){let d=o+a;o=a,a=d}return a}return i=>{let o=s(i)*n;return o<=r?o:r}}function ht(t=100*1e6,e=30*1e9){return(n,r,s)=>{let o=Math.min(e,(s??t)*3);return qt(t,o)}}function Yt(t,e){return(n,r,s)=>n>=e?null:t(n,r,s)}function pe(t){if(t==="constant")return ct(1*1e9);if(t==="linear")return lt(1*1e9);if(t==="exponential")return ft();if(t==="fibonacci")return pt();if(t==="decorrelatedJitter")return ht();throw new Error(`Unknown backoff preset: "${String(t)}". Use one of: constant, linear, exponential, fibonacci, decorrelatedJitter`)}var P,j,Le=E(()=>{"use strict";P=1e6,j=1e9});var B,bt=E(()=>{"use strict";B=class{_timer;_gen=0;start(e,n){this.cancel(),this._gen+=1;let r=this._gen;this._timer=setTimeout(()=>{this._timer=void 0,r===this._gen&&n()},e)}cancel(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}get pending(){return this._timer!==void 0}}});var yt={};Te(yt,{CircuitOpenError:()=>he,RateLimiterOverflowError:()=>me,TimeoutError:()=>be,circuitBreaker:()=>Zt,fallback:()=>sn,rateLimiter:()=>en,retry:()=>Jt,retrySource:()=>Xt,timeout:()=>an,tokenBucket:()=>_t,withBreaker:()=>Qt,withStatus:()=>tn});function G(t){return{describeKind:"derived",...t}}function Kt(t){return t<0?0:t}function ge(t){return t[1]}function gt(t){if(typeof t!="number"||!Number.isFinite(t))throw new TypeError("backoff strategy must return a finite number");return t<0?0:t}function Jt(t,e){let n=e?.count,r=e?.backoff,s=n!==void 0?n:r===void 0?0:2147483647;if(s<0)throw new RangeError("retry count must be >= 0");let i=r===void 0?null:typeof r=="string"?pe(r):r;return N(o=>{let a=0,u=!1,d=null,c,l=new B;function f(){c?.(),c=void 0}function y(g){if(u)return;if(a>=s){f(),o.down([[p,g]]);return}let m=i===null?0:i(a,g,d);if(m==null){f(),o.down([[p,g]]);return}let h;try{h=gt(m)}catch{f(),o.down([[p,g]]);return}d=h,a+=1,f();let x=h>0?h/1e6:1;l.start(x,()=>{u||T()})}function T(){l.cancel(),f(),c=t.subscribe(g=>{if(!u)for(let m of g){let h=m[0];if(h===v)o.down([[v]]);else if(h===b)a=0,d=null,o.emit(m[1]);else if(h===w)o.down([[w]]);else if(h===_)f(),o.down([[_]]);else if(h===p){y(ge(m));return}else o.down([m])}})}return T(),()=>{u=!0,l.cancel(),f()}},{...G(),initial:t.cache})}function Xt(t,e){let n=e?.count,r=e?.backoff,s=n!==void 0?n:r===void 0?0:2147483647;if(s<0)throw new RangeError("retry count must be >= 0");let i=r===void 0?null:typeof r=="string"?pe(r):r;return N(o=>{let a=0,u=!1,d=null,c,l=new B;function f(){c?.(),c=void 0}function y(g){if(u)return;if(a>=s){f(),o.down([[p,g]]);return}let m=i===null?0:i(a,g,d);if(m==null){f(),o.down([[p,g]]);return}let h;try{h=gt(m)}catch{f(),o.down([[p,g]]);return}d=h,a+=1,f();let x=h>0?h/1e6:1;l.start(x,()=>{u||T()})}function T(){l.cancel(),f();let g;try{g=t()}catch(m){y(m);return}c=g.subscribe(m=>{if(!u)for(let h of m){let x=h[0];if(x===v)o.down([[v]]);else if(x===b)a=0,d=null,o.emit(h[1]);else if(x===w)o.down([[w]]);else if(x===_)f(),o.down([[_]]);else if(x===p){y(ge(h));return}else o.down([h])}})}return T(),()=>{u=!0,l.cancel(),f()}},{...G(),initial:e?.initial})}function Zt(t){let e=Math.max(1,t?.failureThreshold??5),n=Kt(t?.cooldownNs??30*1e9),r=t?.cooldown??null,s=Math.max(1,t?.halfOpenMax??1),i=t?.now??V,o="closed",a=0,u=0,d=0,c=n,l=0;function f(){if(!r)return n;let g=r(u);return g!==null?g:n}function y(){o="open",c=f(),d=i(),l=0}return{canExecute(){return o==="closed"?!0:o==="open"?i()-d>=c?(o="half-open",l=1,!0):!1:l<s?(l++,!0):!1},recordSuccess(){o==="half-open"?(o="closed",a=0,u=0):o==="closed"&&(a=0)},recordFailure(g){if(o==="half-open"){u++,y();return}o==="closed"&&(a++,a>=e&&y())},get state(){return o},get failureCount(){return a},reset(){o="closed",a=0,u=0,l=0}}}function Qt(t,e){let n=e?.onOpen??"skip";return r=>{let s=M([],(i,o)=>{function a(){s.meta.breakerState.down([[b,t.state]])}let u=r.subscribe(d=>{for(let c of d){let l=c[0];l===v?o.down([[v]]):l===b?t.canExecute()?(a(),o.emit(c[1])):(a(),n==="error"?o.down([[p,new he]]):o.down([[w]])):l===w?o.down([[w]]):l===_?(t.recordSuccess(),a(),o.down([[_]])):l===p?(t.recordFailure(ge(c)),a(),o.down([c])):o.down([c])}});return a(),u},{...G(),meta:{breakerState:t.state},completeWhenDepsComplete:!1,initial:r.cache});return{node:s,breakerState:s.meta.breakerState}}}function _t(t,e){if(t<=0)throw new RangeError("capacity must be > 0");if(e<0)throw new RangeError("refillPerSecond must be >= 0");let n=t,r=V();function s(i){if(e>0){let o=i-r;n=Math.min(t,n+o/1e9*e)}r=i}return{available(){return s(V()),n},tryConsume(i=1){if(i<=0)return!0;let o=V();return s(o),n>=i?(n-=i,!0):!1},putBack(i=1){i<=0||(s(V()),n=Math.min(t,n+i))}}}function en(t,e){let{maxEvents:n,windowNs:r}=e;if(n<=0)throw new RangeError("maxEvents must be > 0");if(r<=0)throw new RangeError("windowNs must be > 0");let s=e.maxBuffer;if(s!==void 0&&s<1)throw new RangeError("maxBuffer must be >= 1");let i=e.onOverflow??"drop-newest",o=n*1e9/r;return N(a=>{let u=_t(n,o),d=[],c=new B,l=!1,f=1e9/o;function y(){for(;d.length>0;)if(u.tryConsume(1))a.emit(d.shift());else{c.start(Math.max(1,f/1e6),y);return}}let T=t.subscribe(g=>{for(let m of g){if(l)return;let h=m[0];if(h===v)a.down([[v]]);else if(h===b){if(s!==void 0&&d.length>=s){if(i!=="drop-newest")if(i==="drop-oldest")d.shift(),d.push(m[1]);else{l=!0,c.cancel(),d.length=0,a.down([[p,new me(s)]]);return}}else d.push(m[1]);y()}else if(h===w)a.down([[w]]);else if(h===_)l=!0,c.cancel(),d.length=0,a.down([[_]]);else if(h===p)l=!0,c.cancel(),d.length=0,a.down([m]);else if(h===S){l=!0,c.cancel(),d.length=0,a.down([m]);return}else a.down([m])}});return()=>{l=!0,c.cancel(),T()}},{...G(),initial:t.cache})}function tn(t,e){let n=e?.initialStatus??"pending",r=M([],(s,i)=>{let o=n;return r.meta.status.down([[b,n]]),r.meta.error.down([[b,null]]),t.subscribe(u=>{for(let d of u){let c=d[0];if(c===v)i.down([[v]]);else if(c===b)o==="errored"?Se(()=>{r.meta.error.down([[b,null]]),r.meta.status.down([[b,"active"]])}):r.meta.status.down([[b,"active"]]),o="active",i.emit(d[1]);else if(c===w)i.down([[w]]);else if(c===_)r.meta.status.down([[b,"completed"]]),o="completed",i.down([[_]]);else if(c===p){let l=ge(d);Se(()=>{r.meta.error.down([[b,l]]),r.meta.status.down([[b,"errored"]])}),o="errored",i.down([d])}else i.down([d])}})},{...G(),meta:{status:n,error:null},completeWhenDepsComplete:!1,resubscribable:!0,initial:t.cache});return{node:r,status:r.meta.status,error:r.meta.error}}function nn(t){return t!=null&&typeof t=="object"&&"cache"in t&&typeof t.subscribe=="function"}function rn(t){return t!=null&&typeof t.then=="function"}function on(t){return t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function"}function sn(t,e){return N(n=>{let r,s;function i(){s?.(),s=void 0,nn(e)||rn(e)||on(e)?r=Pe(e).subscribe(a=>{n.down(a)}):(n.emit(e),n.down([[_]]))}return s=t.subscribe(o=>{for(let a of o){let u=a[0];if(u===v)n.down([[v]]);else if(u===b)n.emit(a[1]);else if(u===w)n.down([[w]]);else if(u===_)n.down([[_]]);else if(u===p){i();return}else if(u===S){r?.(),n.down([a]);return}else n.down([a])}}),()=>{s?.(),r?.()}},{...G(),initial:t.cache})}function an(t,e){if(e<=0)throw new RangeError("timeoutNs must be > 0");return N(n=>{let r=!1,s=new B;function i(){let a=e/1e6;s.start(a,()=>{r||(r=!0,o(),n.down([[p,new be(e)]]))})}let o=t.subscribe(a=>{for(let u of a){if(r)return;let d=u[0];if(d===v)n.down([[v]]);else if(d===b)i(),n.emit(u[1]);else if(d===w)n.down([[w]]);else if(d===_){s.cancel(),r=!0,n.down([[_]]);return}else if(d===p){s.cancel(),r=!0,n.down([u]);return}else if(d===S){s.cancel(),r=!0,n.down([u]);return}else n.down([u])}});return i(),()=>{r=!0,s.cancel(),o()}},{...G(),initial:t.cache})}var he,me,be,wt=E(()=>{"use strict";Ae();ie();Z();fe();Fe();Le();vt();bt();he=class extends Error{name="CircuitOpenError";constructor(){super("Circuit breaker is open")}};me=class extends Error{name="RateLimiterOverflowError";constructor(e){super(`rateLimiter buffer overflow (maxBuffer=${e})`)}};be=class extends Error{name="TimeoutError";constructor(e){super(`Timed out after ${e/1e6}ms`)}}});var On={};Te(On,{awaitSettled:()=>kn,cached:()=>xn,empty:()=>gn,escapeRegexChar:()=>xt,firstValueFrom:()=>Nn,firstWhere:()=>Ge,forEach:()=>wn,fromAny:()=>Pe,fromAsyncIter:()=>kt,fromCron:()=>pn,fromEvent:()=>hn,fromIter:()=>Ve,fromPromise:()=>Nt,fromRaf:()=>fn,fromTimer:()=>ln,globToRegExp:()=>un,keepalive:()=>Sn,matchesAnyPattern:()=>dn,never:()=>_n,of:()=>Et,reactiveCounter:()=>An,replay:()=>He,share:()=>Tn,shareReplay:()=>En,throwError:()=>yn,toArray:()=>vn});module.exports=Dt(On);function A(t){return{describeKind:"producer",...t}}function xt(t){return/[\\^$+?.()|[\]{}]/.test(t)?`\\${t}`:t}function un(t){let e="^";for(let n=0;n<t.length;n+=1){let r=t[n];if(r==="*"){t[n+1]==="*"?(e+=".*",n+=1):e+="[^/]*";continue}e+=xt(r)}return e+="$",new RegExp(e)}function dn(t,e){for(let n of e)if(n.test(t))return!0;return!1}function cn(t,e){let n=M([t],(s,i)=>{let o=s[0];if(o==null||o.length===0){i.down([[w]]);return}for(let a of o)i.emit(a)},{describeKind:"derived",initial:t.cache}),r=n.subscribe.bind(n);return n.subscribe=(s,i)=>(e(s),r(s,i)),n}function ln(t,e){let{signal:n,period:r,...s}=e??{};return N(i=>{let o=!1,a=0,u,d,c=()=>{o=!0,u!==void 0&&clearTimeout(u),d!==void 0&&clearInterval(d),n?.removeEventListener("abort",f)},l=()=>{o||(r!=null?(i.emit(a++),d=setInterval(()=>{o||i.emit(a++)},r)):(o=!0,n?.removeEventListener("abort",f),i.emit(a++),i.down([[_]])))},f=()=>{o||(c(),i.down([[p,n.reason]]))};if(n?.aborted){f();return}return u=setTimeout(l,t),n?.addEventListener("abort",f,{once:!0}),c},A(s))}function fn(t){let{signal:e,...n}=t??{};return N(r=>{let s=!1,i,o,a=!1,u=!1,d=typeof requestAnimationFrame=="function"?requestAnimationFrame:void 0,c=typeof cancelAnimationFrame=="function"?cancelAnimationFrame:void 0,l=typeof document<"u"?document:void 0,f=()=>{i!==void 0&&c&&c(i),o!==void 0&&clearTimeout(o),i=void 0,o=void 0},y=()=>{s=!0,f(),a&&(e?.removeEventListener("abort",T),a=!1),u&&l&&(l.removeEventListener("visibilitychange",h),u=!1)},T=()=>{s||(y(),r.down([[p,e.reason]]))},g=x=>{s||(r.emit(x),m())},m=()=>{s||(d&&(!l||l.visibilityState!=="hidden")?i=d(g):o=setTimeout(()=>g(performance.now()),16))},h=()=>{s||(f(),m())};return e?.aborted?(T(),y):(e?.addEventListener("abort",T,{once:!0}),a=e!==void 0,l&&d&&(l.addEventListener("visibilitychange",h),u=!0),m(),y)},A(n))}function pn(t,e){let n=at(t),{tickMs:r,output:s,...i}=e??{},o=r??6e4,a=s==="date";return N(u=>{let d=-1,c=()=>{let f=new Date,y=f.getFullYear()*1e8+(f.getMonth()+1)*1e6+f.getDate()*1e4+f.getHours()*100+f.getMinutes();y!==d&&ut(n,f)&&(d=y,u.emit(a?f:se()))};c();let l=setInterval(c,o);return()=>clearInterval(l)},{...A(i),name:i.name??`cron:${t}`})}function hn(t,e,n){let{capture:r,passive:s,once:i,...o}=n??{};return N(a=>{let u=c=>{a.emit(c)},d={capture:r,passive:s,once:i};return t.addEventListener(e,u,d),()=>t.removeEventListener(e,u,d)},A(o))}function Ve(t,e){return N(n=>{let r=!1;try{for(let s of t){if(r)return;n.emit(s)}r||n.down([[_]])}catch(s){r||n.down([[p,s]])}return()=>{r=!0}},A(e))}function mn(t){return t!=null&&typeof t.then=="function"}function Nt(t,e){let{signal:n,...r}=e??{};return N(s=>{let i=!1,o=()=>{i||(i=!0,s.down([[p,n.reason]]))};if(n?.aborted){o();return}return n?.addEventListener("abort",o,{once:!0}),Promise.resolve(t).then(a=>{i||(i=!0,n?.removeEventListener("abort",o),s.emit(a),s.down([[_]]))},a=>{i||(i=!0,n?.removeEventListener("abort",o),s.down([[p,a]]))}),()=>{i=!0,n?.removeEventListener("abort",o)}},A(r))}function kt(t,e){let{signal:n,...r}=e??{};return N(s=>{let i=new AbortController,o=()=>i.abort(n?.reason);n?.aborted?i.abort(n.reason):n?.addEventListener("abort",o,{once:!0});let a=n??i.signal,u=!1,d=t[Symbol.asyncIterator](),c=()=>{u||a.aborted||Promise.resolve(d.next()).then(l=>{if(!(u||a.aborted)){if(l.done){s.down([[_]]);return}s.emit(l.value),c()}},l=>{!u&&!a.aborted&&s.down([[p,l]])})};return c(),()=>{u=!0,n?.removeEventListener("abort",o),i.abort(),Promise.resolve(d.return?.()).catch(()=>{})}},A(r))}function bn(t){return t!=null&&typeof t=="object"&&"cache"in t&&typeof t.subscribe=="function"}function Pe(t,e){if(bn(t))return t;if(mn(t))return Nt(t,e);if(t!=null){let n=t;if(typeof n[Symbol.asyncIterator]=="function")return kt(t,e);if(typeof n[Symbol.iterator]=="function")return Ve(t,e)}return Et(t)}function Et(...t){return Ve(t,void 0)}function gn(t){return N(e=>{e.down([[_]])},A(t))}function _n(t){return N(()=>{},A(t))}function yn(t,e){return N(n=>{n.down([[p,t]])},A(e))}function wn(t,e,n){return M([t],(s,i)=>{let o=s[0];if(o!=null&&o.length>0)for(let a of o)e(a)},{describeKind:"effect",...n}).subscribe(()=>{})}function vn(t,e){return M([t],(n,r,s)=>{s.store.buf||(s.store.buf=[]);let i=s.store.buf,o=n[0];if(o!=null&&o.length>0)for(let a of o)i.push(a);if(s.terminalDeps[0]===!0){r.emit([...i]),r.down([[_]]);return}(o==null||o.length===0)&&r.down([[w]])},{describeKind:"derived",completeWhenDepsComplete:!1,...e})}function Tn(t,e){return N(n=>t.subscribe(r=>{n.down(r)}),{...A(e),initial:t.cache})}function He(t,e,n){if(e<1)throw new RangeError("replay expects bufferSize >= 1");let r=[],s=N(i=>t.subscribe(o=>{for(let a of o)a[0]===b&&(r.push(a[1]),r.length>e&&r.shift());i.down(o)}),{...A(n),initial:t.cache});return cn(s,i=>{for(let o of r)i([[b,o]])})}function xn(t,e){return He(t,1,e)}function Nn(t){return new Promise((e,n)=>{let r=!1,s=!1,i;i=t.subscribe(o=>{for(let a of o){if(r)return;if(a[0]===b){r=!0,e(a[1]),i?(i(),i=void 0):s=!0;return}if(a[0]===p){r=!0,n(a[1]),i?(i(),i=void 0):s=!0;return}if(a[0]===_){r=!0,n(new Error("completed without DATA")),i?(i(),i=void 0):s=!0;return}}}),s&&(i?.(),i=void 0)})}function Ge(t,e){return new Promise((n,r)=>{let s=!1,i=!1,o;o=t.subscribe(a=>{for(let u of a){if(s)return;if(u[0]===b){let d=u[1];if(e(d)){s=!0,n(d),o?(o(),o=void 0):i=!0;return}}if(u[0]===p){s=!0,r(u[1]),o?(o(),o=void 0):i=!0;return}if(u[0]===_){s=!0,r(new Error("completed without matching value")),o?(o(),o=void 0):i=!0;return}}}),i&&(o?.(),o=void 0)})}async function kn(t,e){let n=e?.predicate??(s=>s!=null);if(e?.timeoutMs==null||e.timeoutMs<=0)return await Ge(t,n);if(Be===void 0){let[s,i]=await Promise.all([Promise.resolve().then(()=>(wt(),yt)),Promise.resolve().then(()=>(Le(),mt))]);Be=s.timeout,Tt=i.NS_PER_MS}let r=Be(t,e.timeoutMs*Tt);return await Ge(r,n)}function Sn(t){return t.subscribe(()=>{})}function An(t){let e=it(0);return{node:e,increment(){let n=e.cache??0;return n>=t?!1:(e.down([[v],[b,n+1]]),!0)},get(){return e.cache??0},atCap(){return(e.cache??0)>=t}}}var Be,Tt,En,vt=E(()=>{ie();Z();fe();Fe();dt();En=He});vt();0&&(module.exports={awaitSettled,cached,empty,escapeRegexChar,firstValueFrom,firstWhere,forEach,fromAny,fromAsyncIter,fromCron,fromEvent,fromIter,fromPromise,fromRaf,fromTimer,globToRegExp,keepalive,matchesAnyPattern,never,of,reactiveCounter,replay,share,shareReplay,throwError,toArray});
|
|
1
|
+
"use strict";var ve=Object.defineProperty;var Ot=Object.getOwnPropertyDescriptor;var Mt=Object.getOwnPropertyNames;var Ct=Object.prototype.hasOwnProperty;var E=(t,e)=>()=>(t&&(e=t(t=0)),e);var Te=(t,e)=>{for(var n in e)ve(t,n,{get:e[n],enumerable:!0})},Rt=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Mt(e))!Ct.call(t,o)&&o!==n&&ve(t,o,{get:()=>e[o],enumerable:!(r=Ot(e,o))||r.enumerable});return t};var Dt=t=>Rt(ve({},"__esModule",{value:!0}),t);function V(){return Math.trunc(performance.now()*1e6)}function se(){return Date.now()*1e6}var ie=E(()=>{"use strict"});var J,b,v,w,R,D,X,S,g,p,H,xe,It,Ne,Ft,Lt,ke,Ue,We,$e,Ee,Z=E(()=>{"use strict";J=Symbol.for("graphrefly/START"),b=Symbol.for("graphrefly/DATA"),v=Symbol.for("graphrefly/DIRTY"),w=Symbol.for("graphrefly/RESOLVED"),R=Symbol.for("graphrefly/INVALIDATE"),D=Symbol.for("graphrefly/PAUSE"),X=Symbol.for("graphrefly/RESUME"),S=Symbol.for("graphrefly/TEARDOWN"),g=Symbol.for("graphrefly/COMPLETE"),p=Symbol.for("graphrefly/ERROR"),H=Object.freeze([v]),xe=Object.freeze([w]),It=Object.freeze([R]),Ne=Object.freeze([J]),Ft=Object.freeze([g]),Lt=Object.freeze([S]),ke=Object.freeze([H]),Ue=Object.freeze([xe]),We=Object.freeze([It]),$e=Object.freeze([Ft]),Ee=Object.freeze([Lt])});function je(t){t.registerCodec(Pt)}var Pt,ze=E(()=>{"use strict";Pt={name:"json",version:1,contentType:"application/json",encode(t){let e=JSON.stringify(t);return new TextEncoder().encode(e)},decode(t,e){let n=new TextDecoder().decode(t);return JSON.parse(n)}}});function ae(t){if(t==null)return Bt;let{type:e,id:n,...r}=t;return{type:e??"system",id:n??"",...r}}var Bt,qe=E(()=>{"use strict";Bt={type:"system",id:""}});function Ye(){return U>0||Q}function Ke(){return U>0}function Je(t){U>0?ee.push(t):t()}function Se(t){U+=1;let e=!1;try{t()}catch(n){throw e=!0,n}finally{if(U-=1,U===0)if(e){if(!Q){let n=ee.splice(0);for(let r of n)try{r()}catch{}I.length=0,F.length=0,W.length=0}}else Gt()}}function Gt(){let t=!Q;t&&(Q=!0);let e=[],n=0;try{for(;I.length>0||F.length>0||W.length>0||t&&ee.length>0;){if(t&&ee.length>0){let i=ee.splice(0);for(let s of i)try{s()}catch(a){e.push(a)}continue}if(n+=1,n>1e3)throw I.length=0,F.length=0,W.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let o=(I.length>0?I:F.length>0?F:W).splice(0);for(let i of o)try{i()}catch(s){e.push(s)}}}finally{t&&(Q=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function ue(t,e,n){if(e.length===0)return;if(e.length===1){let d=n(e[0][0]);if(d<3||!Ye()){t(e);return}(d>=5?W:d===4?F:I).push(()=>t(e));return}let r=e.length,o=r,i=r,s=r,a=0;for(;a<r&&n(e[a][0])<3;)a++;for(o=a;a<r&&n(e[a][0])===3;)a++;for(i=a;a<r&&n(e[a][0])===4;)a++;s=a;let u=Ye();if(o>0){let d=e.slice(0,o);t(d)}if(i>o){let d=e.slice(o,i);u?I.push(()=>t(d)):t(d)}if(s>i){let d=e.slice(i,s);u?F.push(()=>t(d)):t(d)}if(r>s){let d=e.slice(s,r);u?W.push(()=>t(d)):t(d)}}var U,Q,I,F,W,ee,Ae=E(()=>{"use strict";U=0,Q=!1,I=[],F=[],W=[],ee=[]});function Xe(t){t.registerMessageType(J,{tier:0,wireCrossing:!1}),t.registerMessageType(v,{tier:1,wireCrossing:!1}),t.registerMessageType(R,{tier:1,wireCrossing:!1,metaPassthrough:!1}),t.registerMessageType(D,{tier:2,wireCrossing:!1}),t.registerMessageType(X,{tier:2,wireCrossing:!1}),t.registerMessageType(b,{tier:3,wireCrossing:!0}),t.registerMessageType(w,{tier:3,wireCrossing:!0}),t.registerMessageType(g,{tier:4,wireCrossing:!0,metaPassthrough:!1}),t.registerMessageType(p,{tier:4,wireCrossing:!0,metaPassthrough:!1}),t.registerMessageType(S,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var de,Ze=E(()=>{"use strict";Z();de=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=n=>{let r=this._messageTypes.get(n);return r!=null?r.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}registerMessageType(e,n){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:n.tier,wireCrossing:n.wireCrossing??n.tier>=3,metaPassthrough:n.metaPassthrough??!0}),this}messageTier(e){let n=this._messageTypes.get(e);return n!=null?n.tier:1}isWireCrossing(e){let n=this._messageTypes.get(e);return n!=null?n.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let n=this._messageTypes.get(e);return n!=null?n.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}}});var $,Qe=E(()=>{"use strict";$=class extends Error{actor;action;nodeName;constructor(e,n){super(n??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}}});function Oe(t){if(t===void 0)return null;if(typeof t=="number"){if(!Number.isFinite(t))throw new TypeError(`Cannot hash non-finite number: ${t}`);if(Number.isInteger(t)&&!Number.isSafeInteger(t))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${t}. Cross-language cid parity is not guaranteed for unsafe integers.`);return t}if(typeof t=="string"||typeof t=="boolean"||t===null)return t;if(Array.isArray(t))return t.map(Oe);if(typeof t=="object"&&t!==null){let e={};for(let n of Object.keys(t).sort())e[n]=Oe(t[n]);return e}return null}function Ut(t){let e=Ht.encode(t),n=e.length,r=n*8,o=n+9+63&-64,i=new Uint8Array(o);i.set(e),i[n]=128;let s=new DataView(i.buffer);s.setUint32(o-4,r>>>0,!1),s.setUint32(o-8,Math.floor(r/4294967296)>>>0,!1);let a=1779033703,u=3144134277,d=1013904242,c=2773480762,l=1359893119,f=2600822924,y=528734635,T=1541459225,_=new Uint32Array(64),m=(x,O)=>x>>>O|x<<32-O;for(let x=0;x<o;x+=64){for(let k=0;k<16;k++)_[k]=s.getUint32(x+k*4,!1);for(let k=16;k<64;k++){let Y=_[k-15],K=_[k-2],oe=m(Y,7)^m(Y,18)^Y>>>3,we=m(K,17)^m(K,19)^K>>>10;_[k]=_[k-16]+oe+_[k-7]+we>>>0}let O=a,z=u,q=d,_e=c,C=l,ne=f,re=y,ye=T;for(let k=0;k<64;k++){let Y=m(C,6)^m(C,11)^m(C,25),K=C&ne^~C&re,oe=ye+Y+K+Vt[k]+_[k]>>>0,we=m(O,2)^m(O,13)^m(O,22),St=O&z^O&q^z&q,At=we+St>>>0;ye=re,re=ne,ne=C,C=_e+oe>>>0,_e=q,q=z,z=O,O=oe+At>>>0}a=a+O>>>0,u=u+z>>>0,d=d+q>>>0,c=c+_e>>>0,l=l+C>>>0,f=f+ne>>>0,y=y+re>>>0,T=T+ye>>>0}let h=x=>x.toString(16).padStart(8,"0");return h(a)+h(u)+h(d)+h(c)+h(l)+h(f)+h(y)+h(T)}function Me(t){let e=Oe(t??null),n=JSON.stringify(e);return Ut(n).slice(0,16)}function Wt(){let t=globalThis.crypto;if(t?.randomUUID)return t.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),n=e()+e()+e()+e();return`${n.slice(0,8)}-${n.slice(8,12)}-4${n.slice(13,16)}-${(parseInt(n.slice(16,17),16)&3|8).toString(16)}${n.slice(17,20)}-${n.slice(20,32)}`}function Ce(t,e,n){let r=n?.id??Wt();if(t===0)return{id:r,version:0};let i=(n?.hash??Me)(e);return{id:r,version:0,cid:i,prev:null}}function et(t,e,n){t.version+=1,"cid"in t&&(t.prev=t.cid,t.cid=n(e))}var Vt,Ht,tt=E(()=>{"use strict";Vt=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ht=new TextEncoder});function ot(t){return{node:t,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function Re(t){t.prevData=void 0,t.dirty=!1,t.involvedThisWave=!1,t.dataBatch.length=0,t.terminal=void 0}function ce(t){return t.length===0?t:typeof t[0]=="symbol"?[t]:t}function M(t,e,n){let r=st(t)?t:[],o=typeof t=="function"?t:typeof e=="function"?e:void 0,i={};return st(t)?i=(De(e)?e:n)??{}:De(t)?i=t:i=(De(e)?e:n)??{},new le(r,o,i)}var nt,rt,$t,jt,Ie,le,st,De,fe=E(()=>{"use strict";ze();qe();Ae();ie();Ze();Qe();Z();tt();nt=()=>{},rt=100;$t=(t,e,n,r)=>{n.direction==="down-in"&&t._onDepMessage(n.depIndex,e)},jt=(t,e,n,r)=>{let o=t;if(o._status==="completed"||o._status==="errored")return;let i=o._cached,s=i===void 0?[Ne]:[Ne,[b,i]];o._status==="dirty"&&s.push(H),ue(e,s,o._config.tierOf)},Ie=new de({onMessage:$t,onSubscribe:jt});Xe(Ie);je(Ie);le=class t{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,n,r){this._config=r.config??Ie,this._config.onMessage,this._optsName=r.name,this._describeKind=r.describeKind,this._equals=r.equals??Object.is,this._resubscribable=r.resubscribable??!1,this._resetOnTeardown=r.resetOnTeardown??!1,this._autoComplete=r.completeWhenDepsComplete??!0,this._autoError=r.errorWhenDepsError??!0,this._pausable=r.pausable??!0,this._guard=r.guard,this._fn=n,this._partial=r.partial??!1,this._cached=r.initial!==void 0?r.initial:void 0,this._status=e.length===0&&n==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=r.versioningHash??this._config.defaultHashFn??Me;let o=r.versioning??this._config.defaultVersioning;this._versioningLevel=o,this._versioning=o!=null?Ce(o,this._cached===void 0?void 0:this._cached,{id:r.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(ot);let i={};for(let[a,u]of Object.entries(r.meta??{})){let d={initial:u,name:`${r.name??"node"}:meta:${a}`,describeKind:"state",config:this._config};r.guard!=null&&(d.guard=r.guard),i[a]=new t([],void 0,d)}Object.freeze(i),this.meta=i,this._hasMeta=Object.keys(i).length>0;let s=this;this._actions={emit(a){s._emit([[b,a]])},down(a){s._emit(ce(a))},up(a){s._emitUp(ce(a))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,n){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let r=this._versioningLevel;if(r!=null&&e<=r)return;let o=n?.hash??this._hashFn;o!==this._hashFn&&(this._hashFn=o);let i=this._cached===void 0?void 0:this._cached,s=this._versioning,a=s?.id??n?.id,u=s?.version??0,d=Ce(e,i,{id:a,hash:o});d.version=u,this._versioning=d,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let n=ae(e);if(this._guard!=null&&!this._guard(n,"observe"))return!1;if(this._extraGuards!=null){for(let r of this._extraGuards)if(!r(n,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let n=this._guard!=null||this._extraGuards!=null,r=e?.actor!=null;if(!n&&!r)return;let o=ae(e?.actor),i=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(o,i))throw new $({actor:o,action:i,nodeName:this.name});if(this._extraGuards!=null){for(let s of this._extraGuards)if(!s(o,i))throw new $({actor:o,action:i,nodeName:this.name})}this._lastMutation={actor:o,timestamp_ns:se()}}down(e,n){let r=ce(e);r.length!==0&&(this._checkGuard(n),this._emit(r))}emit(e,n){this._checkGuard(n),this._emit([[b,e]])}up(e,n){if(this._deps.length===0)return;let r=ce(e);if(r.length===0)return;this._checkGuard(n);let o=n??{internal:!0};this._validateUpTiers(r);for(let i of this._deps)i.node.up?.(r,o)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let n of this._deps)n.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let n=this._config.tierOf;for(let r of e){let o=n(r[0]);if(o===3||o===4)throw new Error(`Node "${this.name}": tier-${o} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,n){if(n!=null&&this._guard!=null){let u=ae(n);if(!this._guard(u,"observe"))throw new $({actor:u,action:"observe",nodeName:this.name})}let o=this._isTerminal&&this._resubscribable;if(o){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let u of this._deps)Re(u);if(this._partial===!1){for(let u of this._deps)if(u.prevData!==void 0||u.dataBatch.length!==0||u.terminal!==void 0||u.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let i;try{i=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:o},this._actions)}catch(u){throw this._sinkCount-=1,u}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let s=this._isTerminal;if(this._sinkCount===1&&!s)try{this._activate()}catch(u){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof i=="function")try{i()}catch{}throw u}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let a=!1;return()=>{a||(a=!0,this._sinkCount-=1,this._removeSink(e),typeof i=="function"&&i(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[n]=this._sinks;this._sinks=n}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,n=0;try{for(let r=0;r<e;r++){let o=r,i=this._deps[r];i.unsub=nt,i.unsub=i.node.subscribe(s=>{if(i.unsub===null)return;let a=this._config.tierOf,u=!1;for(let d of s)a(d[0])>=3&&(u=!0),this._config.onMessage(this,d,{direction:"down-in",depIndex:o},this._actions);u&&this._maybeRunFnOnSettlement()}),n++}}catch(r){this._deps[n].unsub=null;for(let o=0;o<n;o++){let i=this._deps[o];if(i.unsub!=null){let s=i.unsub;i.unsub=null;try{s()}catch{}Re(i)}}throw this._dirtyDepCount=0,r}}_addDep(e){for(let o=0;o<this._deps.length;o++)if(this._deps[o].node===e)return o;let n=this._deps.length,r=ot(e);if(this._deps.push(r),this._sinks==null)return n;r.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(ke),r.unsub=nt;try{r.unsub=e.subscribe(o=>{if(r.unsub===null)return;let i=this._config.tierOf,s=!1;for(let a of o)i(a[0])>=3&&(s=!0),this._config.onMessage(this,a,{direction:"down-in",depIndex:n},this._actions);s&&this._maybeRunFnOnSettlement()})}catch(o){throw r.unsub=null,this._deps.pop(),this._dirtyDepCount--,o}return n}_deactivate(e=!1){let n=this._cleanup;if(this._cleanup=void 0,typeof n=="function")try{n()}catch(r){this._emit([[p,this._wrapFnError("cleanup threw",r)]])}else if(n!=null&&typeof n=="object"){let r=n.deactivate;if(typeof r=="function")try{r()}catch(o){this._emit([[p,this._wrapFnError("cleanup.deactivate threw",o)]])}}for(let r of this._deps){if(r.unsub!=null){let o=r.unsub;r.unsub=null;try{o()}catch{}}Re(r)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,n){let r=this._deps[e],o=n[0];if(this._inspectorHooks!=null){let i={kind:"dep_message",depIndex:e,message:n};for(let s of this._inspectorHooks)s(i)}if(o!==J){if(o===v){this._depDirtied(r);return}if(o===R){if(this._depInvalidated(r),this._cached===void 0)return;this._emit(We);return}if(o===D||o===X){this._emit([n]);return}if(o===S){this._emit(Ee);return}if(o===b)this._depSettledAsData(r,n[1]);else if(o===w)this._depSettledAsResolved(r);else if(o===g)this._depSettledAsTerminal(r,!0);else if(o===p)this._depSettledAsTerminal(r,n[1]);else{this._emit([n]);return}if(!this._fn){(o===b||o===w)&&this._emit([n]),(o===g||o===p)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(ke))}_depSettledAsData(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(n),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=n,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(!this._partial&&!this._hasCalledFnOnce)for(let e=0;e<this._deps.length;e++){let n=this._deps[e];if(n.dataBatch.length===0&&n.prevData===void 0&&n.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(Ue),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(n=>n.terminal!==void 0&&n.terminal!==!0);if(e!=null){this._autoError&&this._emit([[p,e.terminal]]);return}this._autoComplete&&this._deps.every(n=>n.terminal!==void 0)&&this._emit($e)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(s){this._emit([[p,this._wrapFnError("cleanup threw",s)]]);return}}else if(e!=null&&typeof e=="object"){let s=e.beforeRun;if(typeof s=="function"){e.beforeRun=void 0;try{s()}catch(a){this._emit([[p,this._wrapFnError("cleanup.beforeRun threw",a)]]);return}}}let n=this._deps.map(s=>s.involvedThisWave?s.dataBatch.length>0?[...s.dataBatch]:[]:void 0),r=this._deps.map(s=>s.prevData);for(let s=0;s<this._deps.length;s++){let a=n[s];a!=null&&a.length>0&&(this._deps[s].prevData=a[a.length-1])}let o=this._deps.map(s=>s.terminal),i={prevData:r,terminalDeps:o,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let s={kind:"run",batchData:n,prevData:r};for(let a of this._inspectorHooks)a(s)}this._isExecutingFn=!0;try{let s=this._fn(n,this._actions,i);if(typeof s=="function")this._cleanup=s;else if(s!=null&&typeof s=="object"){let a=s;(typeof a.beforeRun=="function"||typeof a.deactivate=="function"||typeof a.invalidate=="function")&&(this._cleanup=s)}}catch(s){this._emit([[p,this._wrapFnError("fn threw",s)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>rt?(this._rerunDepth=0,this._emit([[p,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${rt} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,n){let r=n instanceof Error?n.message:String(n);return new Error(`Node "${this.name}": ${e}: ${r}`,{cause:n})}_frameBatch(e){let n=this._config.tierOf;if(e.length===1)return n(e[0][0])===3&&this._status!=="dirty"?[H,e[0]]:e;let r=!0,o=!1,i=!1,s=-1;for(let u of e){let d=n(u[0]);d<s&&(r=!1),d===3&&(o=!0),u[0]===v&&(i=!0),s=d}let a=e;if(!r){let u=e.map((d,c)=>({m:d,i:c,tier:n(d[0])}));u.sort((d,c)=>d.tier-c.tier||d.i-c.i),a=u.map(d=>d.m)}if(o&&!i&&this._status!=="dirty"){let u=0;for(;u<a.length&&n(a[u][0])===0;)u++;return u===0?[H,...a]:[...a.slice(0,u),H,...a.slice(u)]}return a}_emit(e){if(e.length===0)return;for(let a=0;a<e.length;a++){let u=e[a];if(u[0]===p&&u[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let n=e;if(this._isTerminal&&!this._resubscribable){let a=e.filter(u=>u[0]===S||u[0]===R);if(a.length===0)return;n=a}n=this._frameBatch(n);let o=null;for(let a=0;a<n.length;a++){let u=n[a],d=u[0];if(d!==D&&d!==X){o?.push(u);continue}if(u.length<2)throw new Error(`Node "${this.name}": [[${d===D?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let c=!0;if(this._pausable!==!1){let l=u[1];if(d===D)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(l),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(l))c=!1;else if(this._pauseLocks.delete(l),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let f=this._pauseBuffer;this._pauseBuffer=[],this._emit(f)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?o?.push(u):o==null&&(o=n.slice(0,a))}if(o!=null){if(o.length===0)return;n=o}if(this._hasMeta&&n.some(a=>a[0]===S))for(let a of Object.keys(this.meta))try{this.meta[a]._emit(Ee)}catch{}let{finalMessages:i,equalsError:s}=this._updateState(n);if(i.length>0&&this._config.inspectorEnabled){let a=this._config.globalInspector;if(a!=null)try{a({kind:"emit",node:this,messages:i})}catch{}}if(i.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let a=this._config.tierOf,u=[];for(let d of i)a(d[0])===3?this._pauseBuffer.push(d):u.push(d);u.length>0&&this._dispatchOrAccumulate(u)}else this._dispatchOrAccumulate(i);s!=null&&this._emit([[p,s]])}_updateState(e){let n=this._config.tierOf,r,o,i=-1,s=0;for(let c of e)n(c[0])===3&&s++;let a=s<=1,u=-1;if(this._versioning!=null&&s>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===b){u=c;break}}for(let c=0;c<e.length;c++){let l=e[c],f=l[0];if(f===b){if(l.length>=2){let y=!1;if(a&&this._cached!==void 0)try{y=this._equals(this._cached,l[1])}catch(T){o=this._wrapFnError("equals threw",T),i=c;break}if(y){r==null&&(r=e.slice(0,c)),r.push(xe),this._status="resolved";continue}this._cached=l[1],this._versioning!=null&&(u<0||c===u)&&et(this._versioning,l[1],this._hashFn)}this._status="settled",r?.push(l)}else if(r?.push(l),f===v)this._status="dirty";else if(f===w)this._status="resolved";else if(f===g)this._status="completed";else if(f===p)this._status="errored";else if(f===R){this._cached=void 0,this._status="dirty";let y=this._cleanup;if(typeof y=="function"){this._cleanup=void 0;try{y()}catch{}}else if(y!=null&&typeof y=="object"){let T=y.invalidate;if(typeof T=="function")try{T()}catch{}}}else f===S&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let d=i>=0?r??e.slice(0,i):r??e;return o!=null?{finalMessages:d,equalsError:o}:{finalMessages:d}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let n=[...this._sinks];for(let r of n)r(e)};_dispatchOrAccumulate(e){if(Ke()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Je(()=>this._flushBatchPending()));for(let n of e)this._batchPendingMessages.push(n);return}ue(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let n=this._frameBatch(e);ue(this._deliverToSinks,n,this._config.tierOf)}},st=t=>Array.isArray(t),De=t=>typeof t=="object"&&t!=null&&!Array.isArray(t)});function it(t,e){return M([],{...e,initial:t})}function N(t,e){return M((r,o,i)=>t(o,i)??void 0,{describeKind:"producer",...e})}var Fe=E(()=>{"use strict";fe()});function te(t,e,n){let r=new Set;for(let o of t.split(",")){let[i,s]=o.split("/"),a=s?Number.parseInt(s,10):1;if(Number.isNaN(a)||a<1)throw new Error(`Invalid cron step: ${o}`);let u,d;if(i==="*")u=e,d=n;else if(i.includes("-")){let[c,l]=i.split("-");u=Number.parseInt(c,10),d=Number.parseInt(l,10)}else u=Number.parseInt(i,10),d=u;if(Number.isNaN(u)||Number.isNaN(d))throw new Error(`Invalid cron field: ${t}`);if(u<e||d>n)throw new Error(`Cron field out of range: ${t} (${e}-${n})`);if(u>d)throw new Error(`Invalid cron range: ${u}-${d} in ${t}`);for(let c=u;c<=d;c+=a)r.add(c)}return r}function at(t){let e=t.trim().split(/\s+/);if(e.length!==5)throw new Error(`Invalid cron: expected 5 fields, got ${e.length}`);return{minutes:te(e[0],0,59),hours:te(e[1],0,23),daysOfMonth:te(e[2],1,31),months:te(e[3],1,12),daysOfWeek:te(e[4],0,6)}}function ut(t,e){return t.minutes.has(e.getMinutes())&&t.hours.has(e.getHours())&&t.daysOfMonth.has(e.getDate())&&t.months.has(e.getMonth()+1)&&t.daysOfWeek.has(e.getDay())}var dt=E(()=>{"use strict"});var mt={};Te(mt,{NS_PER_MS:()=>P,NS_PER_SEC:()=>j,constant:()=>ct,decorrelatedJitter:()=>ht,exponential:()=>ft,fibonacci:()=>pt,linear:()=>lt,resolveBackoffPreset:()=>pe,withMaxAttempts:()=>Yt});function L(t){return t<0?0:t}function zt(t,e){return e==="none"?t:e==="full"?Math.random()*t:t/2+Math.random()*(t/2)}function qt(t,e){return t+Math.random()*(e-t)}function ct(t){let e=L(t);return()=>e}function lt(t,e){let n=L(t),r=e===void 0?n:L(e);return o=>n+r*Math.max(0,o)}function ft(t){let e=L(t?.baseNs??1e8),n=t?.factor!==void 0&&t.factor<1?1:t?.factor??2,r=L(t?.maxDelayNs??30*1e9),o=t?.jitter??"none";return i=>{let s;if(e===0)s=0;else if(n===1)s=e;else{let a=r/e,u=1;for(let d=0;d<Math.max(0,i);d++){if(u>=a){u=a;break}u*=n}s=e*u,s>r&&(s=r)}return zt(s,o)}}function pt(t=100*1e6,e=30*1e9){let n=L(t),r=L(e);function o(i){if(i<=0)return 1;let s=1,a=2;for(let u=1;u<i;u++){let d=s+a;s=a,a=d}return a}return i=>{let s=o(i)*n;return s<=r?s:r}}function ht(t=100*1e6,e=30*1e9){return(n,r,o)=>{let s=Math.min(e,(o??t)*3);return qt(t,s)}}function Yt(t,e){return(n,r,o)=>n>=e?null:t(n,r,o)}function pe(t){if(t==="constant")return ct(1*1e9);if(t==="linear")return lt(1*1e9);if(t==="exponential")return ft();if(t==="fibonacci")return pt();if(t==="decorrelatedJitter")return ht();throw new Error(`Unknown backoff preset: "${String(t)}". Use one of: constant, linear, exponential, fibonacci, decorrelatedJitter`)}var P,j,Le=E(()=>{"use strict";P=1e6,j=1e9});var B,bt=E(()=>{"use strict";B=class{_timer;_gen=0;start(e,n){this.cancel(),this._gen+=1;let r=this._gen;this._timer=setTimeout(()=>{this._timer=void 0,r===this._gen&&n()},e)}cancel(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}get pending(){return this._timer!==void 0}}});var yt={};Te(yt,{CircuitOpenError:()=>he,RateLimiterOverflowError:()=>me,TimeoutError:()=>be,circuitBreaker:()=>Zt,fallback:()=>sn,rateLimiter:()=>en,retry:()=>Jt,retrySource:()=>Xt,timeout:()=>an,tokenBucket:()=>_t,withBreaker:()=>Qt,withStatus:()=>tn});function G(t){return{describeKind:"derived",...t}}function Kt(t){return t<0?0:t}function ge(t){return t[1]}function gt(t){if(typeof t!="number"||!Number.isFinite(t))throw new TypeError("backoff strategy must return a finite number");return t<0?0:t}function Jt(t,e){let n=e?.count,r=e?.backoff,o=n!==void 0?n:r===void 0?0:2147483647;if(o<0)throw new RangeError("retry count must be >= 0");let i=r===void 0?null:typeof r=="string"?pe(r):r;return N(s=>{let a=0,u=!1,d=null,c,l=new B;function f(){c?.(),c=void 0}function y(_){if(u)return;if(a>=o){f(),s.down([[p,_]]);return}let m=i===null?0:i(a,_,d);if(m==null){f(),s.down([[p,_]]);return}let h;try{h=gt(m)}catch{f(),s.down([[p,_]]);return}d=h,a+=1,f();let x=h>0?h/1e6:1;l.start(x,()=>{u||T()})}function T(){l.cancel(),f(),c=t.subscribe(_=>{if(!u)for(let m of _){let h=m[0];if(h===v)s.down([[v]]);else if(h===b)a=0,d=null,s.emit(m[1]);else if(h===w)s.down([[w]]);else if(h===g)f(),s.down([[g]]);else if(h===p){y(ge(m));return}else s.down([m])}})}return T(),()=>{u=!0,l.cancel(),f()}},{...G(),initial:t.cache})}function Xt(t,e){let n=e?.count,r=e?.backoff,o=n!==void 0?n:r===void 0?0:2147483647;if(o<0)throw new RangeError("retry count must be >= 0");let i=r===void 0?null:typeof r=="string"?pe(r):r;return N(s=>{let a=0,u=!1,d=null,c,l=new B;function f(){c?.(),c=void 0}function y(_){if(u)return;if(a>=o){f(),s.down([[p,_]]);return}let m=i===null?0:i(a,_,d);if(m==null){f(),s.down([[p,_]]);return}let h;try{h=gt(m)}catch{f(),s.down([[p,_]]);return}d=h,a+=1,f();let x=h>0?h/1e6:1;l.start(x,()=>{u||T()})}function T(){l.cancel(),f();let _;try{_=t()}catch(m){y(m);return}c=_.subscribe(m=>{if(!u)for(let h of m){let x=h[0];if(x===v)s.down([[v]]);else if(x===b)a=0,d=null,s.emit(h[1]);else if(x===w)s.down([[w]]);else if(x===g)f(),s.down([[g]]);else if(x===p){y(ge(h));return}else s.down([h])}})}return T(),()=>{u=!0,l.cancel(),f()}},{...G(),initial:e?.initial})}function Zt(t){let e=Math.max(1,t?.failureThreshold??5),n=Kt(t?.cooldownNs??30*1e9),r=t?.cooldown??null,o=Math.max(1,t?.halfOpenMax??1),i=t?.now??V,s="closed",a=0,u=0,d=0,c=n,l=0;function f(){if(!r)return n;let _=r(u);return _!==null?_:n}function y(){s="open",c=f(),d=i(),l=0}return{canExecute(){return s==="closed"?!0:s==="open"?i()-d>=c?(s="half-open",l=1,!0):!1:l<o?(l++,!0):!1},recordSuccess(){s==="half-open"?(s="closed",a=0,u=0):s==="closed"&&(a=0)},recordFailure(_){if(s==="half-open"){u++,y();return}s==="closed"&&(a++,a>=e&&y())},get state(){return s},get failureCount(){return a},reset(){s="closed",a=0,u=0,l=0}}}function Qt(t,e){let n=e?.onOpen??"skip";return r=>{let o=M([],(i,s)=>{function a(){o.meta.breakerState.down([[b,t.state]])}let u=r.subscribe(d=>{for(let c of d){let l=c[0];l===v?s.down([[v]]):l===b?t.canExecute()?(a(),s.emit(c[1])):(a(),n==="error"?s.down([[p,new he]]):s.down([[w]])):l===w?s.down([[w]]):l===g?(t.recordSuccess(),a(),s.down([[g]])):l===p?(t.recordFailure(ge(c)),a(),s.down([c])):s.down([c])}});return a(),u},{...G(),meta:{breakerState:t.state},completeWhenDepsComplete:!1,initial:r.cache});return{node:o,breakerState:o.meta.breakerState}}}function _t(t,e){if(t<=0)throw new RangeError("capacity must be > 0");if(e<0)throw new RangeError("refillPerSecond must be >= 0");let n=t,r=V();function o(i){if(e>0){let s=i-r;n=Math.min(t,n+s/1e9*e)}r=i}return{available(){return o(V()),n},tryConsume(i=1){if(i<=0)return!0;let s=V();return o(s),n>=i?(n-=i,!0):!1},putBack(i=1){i<=0||(o(V()),n=Math.min(t,n+i))}}}function en(t,e){let{maxEvents:n,windowNs:r}=e;if(n<=0)throw new RangeError("maxEvents must be > 0");if(r<=0)throw new RangeError("windowNs must be > 0");let o=e.maxBuffer;if(o!==void 0&&o<1)throw new RangeError("maxBuffer must be >= 1");let i=e.onOverflow??"drop-newest",s=n*1e9/r;return N(a=>{let u=_t(n,s),d=[],c=new B,l=!1,f=1e9/s;function y(){for(;d.length>0;)if(u.tryConsume(1))a.emit(d.shift());else{c.start(Math.max(1,f/1e6),y);return}}let T=t.subscribe(_=>{for(let m of _){if(l)return;let h=m[0];if(h===v)a.down([[v]]);else if(h===b){if(o!==void 0&&d.length>=o){if(i!=="drop-newest")if(i==="drop-oldest")d.shift(),d.push(m[1]);else{l=!0,c.cancel(),d.length=0,a.down([[p,new me(o)]]);return}}else d.push(m[1]);y()}else if(h===w)a.down([[w]]);else if(h===g)l=!0,c.cancel(),d.length=0,a.down([[g]]);else if(h===p)l=!0,c.cancel(),d.length=0,a.down([m]);else if(h===S){l=!0,c.cancel(),d.length=0,a.down([m]);return}else a.down([m])}});return()=>{l=!0,c.cancel(),T()}},{...G(),initial:t.cache})}function tn(t,e){let n=e?.initialStatus??"pending",r=M([],(o,i)=>{let s=n;return r.meta.status.down([[b,n]]),r.meta.error.down([[b,null]]),t.subscribe(u=>{for(let d of u){let c=d[0];if(c===v)i.down([[v]]);else if(c===b)s==="errored"?Se(()=>{r.meta.error.down([[b,null]]),r.meta.status.down([[b,"active"]])}):r.meta.status.down([[b,"active"]]),s="active",i.emit(d[1]);else if(c===w)i.down([[w]]);else if(c===g)r.meta.status.down([[b,"completed"]]),s="completed",i.down([[g]]);else if(c===p){let l=ge(d);Se(()=>{r.meta.error.down([[b,l]]),r.meta.status.down([[b,"errored"]])}),s="errored",i.down([d])}else i.down([d])}})},{...G(),meta:{status:n,error:null},completeWhenDepsComplete:!1,resubscribable:!0,initial:t.cache});return{node:r,status:r.meta.status,error:r.meta.error}}function nn(t){return t!=null&&typeof t=="object"&&"cache"in t&&typeof t.subscribe=="function"}function rn(t){return t!=null&&typeof t.then=="function"}function on(t){return t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function"}function sn(t,e){return N(n=>{let r,o;function i(){o?.(),o=void 0,nn(e)||rn(e)||on(e)?r=Pe(e).subscribe(a=>{n.down(a)}):(n.emit(e),n.down([[g]]))}return o=t.subscribe(s=>{for(let a of s){let u=a[0];if(u===v)n.down([[v]]);else if(u===b)n.emit(a[1]);else if(u===w)n.down([[w]]);else if(u===g)n.down([[g]]);else if(u===p){i();return}else if(u===S){r?.(),n.down([a]);return}else n.down([a])}}),()=>{o?.(),r?.()}},{...G(),initial:t.cache})}function an(t,e){if(e<=0)throw new RangeError("timeoutNs must be > 0");return N(n=>{let r=!1,o=new B;function i(){let a=e/1e6;o.start(a,()=>{r||(r=!0,s(),n.down([[p,new be(e)]]))})}let s=t.subscribe(a=>{for(let u of a){if(r)return;let d=u[0];if(d===v)n.down([[v]]);else if(d===b)i(),n.emit(u[1]);else if(d===w)n.down([[w]]);else if(d===g){o.cancel(),r=!0,n.down([[g]]);return}else if(d===p){o.cancel(),r=!0,n.down([u]);return}else if(d===S){o.cancel(),r=!0,n.down([u]);return}else n.down([u])}});return i(),()=>{r=!0,o.cancel(),s()}},{...G(),initial:t.cache})}var he,me,be,wt=E(()=>{"use strict";Ae();ie();Z();fe();Fe();Le();vt();bt();he=class extends Error{name="CircuitOpenError";constructor(){super("Circuit breaker is open")}};me=class extends Error{name="RateLimiterOverflowError";constructor(e){super(`rateLimiter buffer overflow (maxBuffer=${e})`)}};be=class extends Error{name="TimeoutError";constructor(e){super(`Timed out after ${e/1e6}ms`)}}});var Mn={};Te(Mn,{awaitSettled:()=>kn,cached:()=>xn,empty:()=>gn,escapeRegexChar:()=>xt,firstValueFrom:()=>Nn,firstWhere:()=>Ge,forEach:()=>wn,fromAny:()=>Pe,fromAsyncIter:()=>kt,fromCron:()=>pn,fromEvent:()=>hn,fromIter:()=>Ve,fromPromise:()=>Nt,fromRaf:()=>fn,fromTimer:()=>ln,globToRegExp:()=>un,keepalive:()=>An,matchesAnyPattern:()=>dn,never:()=>_n,nodeSignal:()=>En,of:()=>Et,reactiveCounter:()=>On,replay:()=>He,share:()=>Tn,shareReplay:()=>Sn,throwError:()=>yn,toArray:()=>vn});module.exports=Dt(Mn);function A(t){return{describeKind:"producer",...t}}function xt(t){return/[\\^$+?.()|[\]{}]/.test(t)?`\\${t}`:t}function un(t){let e="^";for(let n=0;n<t.length;n+=1){let r=t[n];if(r==="*"){t[n+1]==="*"?(e+=".*",n+=1):e+="[^/]*";continue}e+=xt(r)}return e+="$",new RegExp(e)}function dn(t,e){for(let n of e)if(n.test(t))return!0;return!1}function cn(t,e){let n=M([t],(o,i)=>{let s=o[0];if(s==null||s.length===0){i.down([[w]]);return}for(let a of s)i.emit(a)},{describeKind:"derived",initial:t.cache}),r=n.subscribe.bind(n);return n.subscribe=(o,i)=>(e(o),r(o,i)),n}function ln(t,e){let{signal:n,period:r,...o}=e??{};return N(i=>{let s=!1,a=0,u,d,c=()=>{s=!0,u!==void 0&&clearTimeout(u),d!==void 0&&clearInterval(d),n?.removeEventListener("abort",f)},l=()=>{s||(r!=null?(i.emit(a++),d=setInterval(()=>{s||i.emit(a++)},r)):(s=!0,n?.removeEventListener("abort",f),i.emit(a++),i.down([[g]])))},f=()=>{s||(c(),i.down([[p,n.reason]]))};if(n?.aborted){f();return}return u=setTimeout(l,t),n?.addEventListener("abort",f,{once:!0}),c},A(o))}function fn(t){let{signal:e,...n}=t??{};return N(r=>{let o=!1,i,s,a=!1,u=!1,d=typeof requestAnimationFrame=="function"?requestAnimationFrame:void 0,c=typeof cancelAnimationFrame=="function"?cancelAnimationFrame:void 0,l=typeof document<"u"?document:void 0,f=()=>{i!==void 0&&c&&c(i),s!==void 0&&clearTimeout(s),i=void 0,s=void 0},y=()=>{o=!0,f(),a&&(e?.removeEventListener("abort",T),a=!1),u&&l&&(l.removeEventListener("visibilitychange",h),u=!1)},T=()=>{o||(y(),r.down([[p,e.reason]]))},_=x=>{o||(r.emit(x),m())},m=()=>{o||(d&&(!l||l.visibilityState!=="hidden")?i=d(_):s=setTimeout(()=>_(performance.now()),16))},h=()=>{o||(f(),m())};return e?.aborted?(T(),y):(e?.addEventListener("abort",T,{once:!0}),a=e!==void 0,l&&d&&(l.addEventListener("visibilitychange",h),u=!0),m(),y)},A(n))}function pn(t,e){let n=at(t),{tickMs:r,output:o,...i}=e??{},s=r??6e4,a=o==="date";return N(u=>{let d=-1,c=()=>{let f=new Date,y=f.getFullYear()*1e8+(f.getMonth()+1)*1e6+f.getDate()*1e4+f.getHours()*100+f.getMinutes();y!==d&&ut(n,f)&&(d=y,u.emit(a?f:se()))};c();let l=setInterval(c,s);return()=>clearInterval(l)},{...A(i),name:i.name??`cron:${t}`})}function hn(t,e,n){let{capture:r,passive:o,once:i,...s}=n??{};return N(a=>{let u=c=>{a.emit(c)},d={capture:r,passive:o,once:i};return t.addEventListener(e,u,d),()=>t.removeEventListener(e,u,d)},A(s))}function Ve(t,e){return N(n=>{let r=!1;try{for(let o of t){if(r)return;n.emit(o)}r||n.down([[g]])}catch(o){r||n.down([[p,o]])}return()=>{r=!0}},A(e))}function mn(t){return t!=null&&typeof t.then=="function"}function Nt(t,e){let{signal:n,...r}=e??{};return N(o=>{let i=!1,s=()=>{i||(i=!0,o.down([[p,n.reason]]))};if(n?.aborted){s();return}return n?.addEventListener("abort",s,{once:!0}),Promise.resolve(t).then(a=>{i||(i=!0,n?.removeEventListener("abort",s),o.emit(a),o.down([[g]]))},a=>{i||(i=!0,n?.removeEventListener("abort",s),o.down([[p,a]]))}),()=>{i=!0,n?.removeEventListener("abort",s)}},A(r))}function kt(t,e){let{signal:n,...r}=e??{};return N(o=>{let i=new AbortController,s=()=>i.abort(n?.reason);n?.aborted?i.abort(n.reason):n?.addEventListener("abort",s,{once:!0});let a=n??i.signal,u=!1,d=t[Symbol.asyncIterator](),c=()=>{u||a.aborted||Promise.resolve(d.next()).then(l=>{if(!(u||a.aborted)){if(l.done){o.down([[g]]);return}o.emit(l.value),c()}},l=>{!u&&!a.aborted&&o.down([[p,l]])})};return c(),()=>{u=!0,n?.removeEventListener("abort",s),i.abort(),Promise.resolve(d.return?.()).catch(()=>{})}},A(r))}function bn(t){return t!=null&&typeof t=="object"&&"cache"in t&&typeof t.subscribe=="function"}function Pe(t,e){if(bn(t))return t;if(mn(t))return Nt(t,e);if(t!=null){let n=t;if(typeof n[Symbol.asyncIterator]=="function")return kt(t,e);if(typeof n[Symbol.iterator]=="function")return Ve(t,e)}return Et(t)}function Et(...t){return Ve(t,void 0)}function gn(t){return N(e=>{e.down([[g]])},A(t))}function _n(t){return N(()=>{},A(t))}function yn(t,e){return N(n=>{n.down([[p,t]])},A(e))}function wn(t,e,n){return M([t],(o,i)=>{let s=o[0];if(s!=null&&s.length>0)for(let a of s)e(a)},{describeKind:"effect",...n}).subscribe(()=>{})}function vn(t,e){return M([t],(n,r,o)=>{o.store.buf||(o.store.buf=[]);let i=o.store.buf,s=n[0];if(s!=null&&s.length>0)for(let a of s)i.push(a);if(o.terminalDeps[0]===!0){r.emit([...i]),r.down([[g]]);return}(s==null||s.length===0)&&r.down([[w]])},{describeKind:"derived",completeWhenDepsComplete:!1,...e})}function Tn(t,e){return N(n=>t.subscribe(r=>{n.down(r)}),{...A(e),initial:t.cache})}function He(t,e,n){if(e<1)throw new RangeError("replay expects bufferSize >= 1");let r=[],o=N(i=>t.subscribe(s=>{for(let a of s)a[0]===b&&(r.push(a[1]),r.length>e&&r.shift());i.down(s)}),{...A(n),initial:t.cache});return cn(o,i=>{for(let s of r)i([[b,s]])})}function xn(t,e){return He(t,1,e)}function Nn(t){return new Promise((e,n)=>{let r=!1,o=!1,i;i=t.subscribe(s=>{for(let a of s){if(r)return;if(a[0]===b){r=!0,e(a[1]),i?(i(),i=void 0):o=!0;return}if(a[0]===p){r=!0,n(a[1]),i?(i(),i=void 0):o=!0;return}if(a[0]===g){r=!0,n(new Error("completed without DATA")),i?(i(),i=void 0):o=!0;return}}}),o&&(i?.(),i=void 0)})}function Ge(t,e,n){return new Promise((r,o)=>{let i=!1,s=!1,a,u=n?.skipCurrent===!0;a=t.subscribe(d=>{for(let c of d){if(i)return;if(!(u&&c[0]===b)){if(c[0]===b){let l=c[1];if(e(l)){i=!0,r(l),a?(a(),a=void 0):s=!0;return}}if(c[0]===p){i=!0,o(c[1]),a?(a(),a=void 0):s=!0;return}if(c[0]===g){i=!0,o(new Error("completed without matching value")),a?(a(),a=void 0):s=!0;return}}}}),u=!1,s&&(a?.(),a=void 0)})}async function kn(t,e){let n=e?.predicate??(i=>i!=null),r=e?.skipCurrent;if(e?.timeoutMs==null||e.timeoutMs<=0)return await Ge(t,n,{skipCurrent:r});if(Be===void 0){let[i,s]=await Promise.all([Promise.resolve().then(()=>(wt(),yt)),Promise.resolve().then(()=>(Le(),mt))]);Be=i.timeout,Tt=s.NS_PER_MS}let o=Be(t,e.timeoutMs*Tt);return await Ge(o,n,{skipCurrent:r})}function En(t,e){let n=new AbortController,r=e?.reason??new Error("cancelled via nodeSignal"),o,i=!1,s=()=>{o?(o(),o=void 0):i=!0};return o=t.subscribe(a=>{if(!n.signal.aborted)for(let u of a){if(u[0]===b&&u[1]===!0){n.abort(r),s();return}if(u[0]===p){n.abort(u[1]),s();return}if(u[0]===g){s();return}}}),i&&(o?.(),o=void 0),{signal:n.signal,dispose:()=>{o&&(o(),o=void 0)}}}function An(t){return t.subscribe(()=>{})}function On(t){let e=it(0);return{node:e,increment(){let n=e.cache??0;return n>=t?!1:(e.down([[v],[b,n+1]]),!0)},get(){return e.cache??0},atCap(){return(e.cache??0)>=t}}}var Be,Tt,Sn,vt=E(()=>{ie();Z();fe();Fe();dt();Sn=He});vt();0&&(module.exports={awaitSettled,cached,empty,escapeRegexChar,firstValueFrom,firstWhere,forEach,fromAny,fromAsyncIter,fromCron,fromEvent,fromIter,fromPromise,fromRaf,fromTimer,globToRegExp,keepalive,matchesAnyPattern,never,nodeSignal,of,reactiveCounter,replay,share,shareReplay,throwError,toArray});
|