@graphrefly/graphrefly 0.42.0 → 0.44.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-CH-_VwG9.d.cts → cascading-BglDkMdX.d.cts} +2 -2
- package/dist/{cascading-OgKQZjsa.d.ts → cascading-MFgxu7Yo.d.ts} +2 -2
- package/dist/chunk-2T7U5EU6.js +1 -0
- package/dist/chunk-5M4CCMMD.js +45 -0
- package/dist/{chunk-YGL7FPVQ.js → chunk-5XJ6B66J.js} +1 -1
- package/dist/{chunk-NWXQIOIB.js → chunk-6X7AFUJV.js} +1 -1
- package/dist/chunk-7K6PWTDQ.js +1 -0
- package/dist/{chunk-D27JNOLZ.js → chunk-7LIAPXJB.js} +1 -1
- package/dist/{chunk-CLD3F4R5.js → chunk-7WPU3UHQ.js} +1 -1
- package/dist/{chunk-NNKJUORL.js → chunk-A5WCQ5NO.js} +1 -1
- package/dist/chunk-APPIWSGD.js +84 -0
- package/dist/{chunk-TZQPPQEQ.js → chunk-BEZWM2SY.js} +1 -1
- package/dist/{chunk-5QRRKBUT.js → chunk-CB676TKJ.js} +1 -1
- package/dist/{chunk-KT5DTRBP.js → chunk-CE6TI2TL.js} +1 -1
- package/dist/{chunk-6YFZMUMR.js → chunk-CLVB32RD.js} +1 -1
- package/dist/{chunk-2K5RXLAH.js → chunk-CRVT7D2P.js} +1 -1
- package/dist/chunk-D7GPHKFH.js +1 -0
- package/dist/{chunk-FUZ6S2DY.js → chunk-DHRX7JX4.js} +1 -1
- package/dist/chunk-FZMYDOWV.js +1 -0
- package/dist/{chunk-35JTVPOX.js → chunk-GHBWHMRZ.js} +1 -1
- package/dist/{chunk-KGKJCHEK.js → chunk-GLERH466.js} +1 -1
- package/dist/{chunk-CISGGAIF.js → chunk-HIDYF36O.js} +1 -1
- package/dist/chunk-HITNVN6B.js +3 -0
- package/dist/{chunk-7ARY3Y3T.js → chunk-HY4DJBA7.js} +1 -1
- package/dist/chunk-KZIEYVXN.js +1 -0
- package/dist/{chunk-IZM3UEH3.js → chunk-N4MQX6JU.js} +1 -1
- package/dist/{chunk-FDZAZNRO.js → chunk-N7FHEL4D.js} +1 -1
- package/dist/chunk-NTEURFZH.js +1 -0
- package/dist/{chunk-4QH6VJF4.js → chunk-OIVP6KFV.js} +1 -1
- package/dist/{chunk-KCACBSJH.js → chunk-OPHBU3LG.js} +1 -1
- package/dist/{chunk-Q7QQQA3I.js → chunk-OYQOZP2F.js} +1 -1
- package/dist/{chunk-7B7ELAT2.js → chunk-PTZK576G.js} +1 -1
- package/dist/{chunk-DEJTNNQC.js → chunk-ST7UXLWR.js} +1 -1
- package/dist/chunk-SVY7VUYU.js +1 -0
- package/dist/{chunk-WHMUB5QB.js → chunk-TK3NWWD4.js} +1 -1
- package/dist/chunk-UNGSTR4X.js +61 -0
- package/dist/{chunk-VRALOYRD.js → chunk-VV4N5P64.js} +1 -1
- package/dist/chunk-W3I423PS.js +1 -0
- package/dist/{chunk-HZKW2AAB.js → chunk-WJR24TAG.js} +1 -1
- package/dist/{chunk-F3IGTWCQ.js → chunk-XTGKMHSW.js} +1 -1
- package/dist/{chunk-LDQ3IUIP.js → chunk-YBB7ZGTY.js} +1 -1
- package/dist/{chunk-G5VBJ5K6.js → chunk-Z4NPUARF.js} +1 -1
- package/dist/{chunk-KRH66M4O.js → chunk-ZGNQRPDT.js} +1 -1
- package/dist/{chunk-AGNM6RS6.js → chunk-ZKPSFFKU.js} +1 -1
- package/dist/{chunk-KY2LMAXU.js → chunk-ZLV5SQSX.js} +1 -1
- package/dist/compat/index.cjs +5 -5
- package/dist/compat/index.d.cts +16 -16
- package/dist/compat/index.d.ts +16 -16
- package/dist/compat/index.js +1 -1
- package/dist/compat/jotai/index.cjs +1 -1
- package/dist/compat/jotai/index.d.cts +2 -2
- package/dist/compat/jotai/index.d.ts +2 -2
- package/dist/compat/jotai/index.js +1 -1
- package/dist/compat/nanostores/index.cjs +1 -1
- package/dist/compat/nanostores/index.d.cts +2 -2
- package/dist/compat/nanostores/index.d.ts +2 -2
- package/dist/compat/nanostores/index.js +1 -1
- package/dist/compat/nestjs/index.cjs +5 -5
- package/dist/compat/nestjs/index.d.cts +8 -8
- package/dist/compat/nestjs/index.d.ts +8 -8
- package/dist/compat/nestjs/index.js +1 -1
- package/dist/compat/react/index.d.cts +2 -2
- package/dist/compat/react/index.d.ts +2 -2
- package/dist/compat/solid/index.d.cts +2 -2
- package/dist/compat/solid/index.d.ts +2 -2
- package/dist/compat/svelte/index.d.cts +2 -2
- package/dist/compat/svelte/index.d.ts +2 -2
- package/dist/compat/vue/index.d.cts +2 -2
- package/dist/compat/vue/index.d.ts +2 -2
- package/dist/compat/zustand/index.cjs +3 -3
- package/dist/compat/zustand/index.d.cts +4 -4
- package/dist/compat/zustand/index.d.ts +4 -4
- package/dist/compat/zustand/index.js +1 -1
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +3 -4
- package/dist/core/index.d.ts +3 -4
- package/dist/core/index.js +1 -1
- package/dist/{decay-CdEBmDIs.d.ts → decay-BvOWTZ00.d.ts} +2 -2
- package/dist/{decay-2ZukgQ4o.d.cts → decay-CFlLvXUT.d.cts} +2 -2
- package/dist/extra/browser.cjs +1 -1
- package/dist/extra/browser.d.cts +1 -1
- package/dist/extra/browser.d.ts +1 -1
- package/dist/extra/browser.js +1 -1
- package/dist/extra/index.cjs +15 -15
- package/dist/extra/index.d.cts +10 -10
- package/dist/extra/index.d.ts +10 -10
- package/dist/extra/index.js +1 -1
- package/dist/extra/node.cjs +2 -2
- package/dist/extra/node.d.cts +1 -1
- package/dist/extra/node.d.ts +1 -1
- package/dist/extra/node.js +1 -1
- package/dist/extra/operators.cjs +1 -1
- package/dist/extra/operators.d.cts +9 -1
- package/dist/extra/operators.d.ts +9 -1
- package/dist/extra/operators.js +1 -1
- package/dist/extra/reactive.cjs +1 -1
- package/dist/extra/reactive.d.cts +3 -3
- package/dist/extra/reactive.d.ts +3 -3
- package/dist/extra/reactive.js +1 -1
- package/dist/extra/render/index.d.cts +3 -3
- package/dist/extra/render/index.d.ts +3 -3
- package/dist/extra/sources.cjs +3 -3
- package/dist/extra/sources.d.cts +1 -1
- package/dist/extra/sources.d.ts +1 -1
- package/dist/extra/sources.js +1 -1
- package/dist/extra/storage-browser.cjs +1 -1
- package/dist/extra/storage-browser.d.cts +1 -1
- package/dist/extra/storage-browser.d.ts +1 -1
- package/dist/extra/storage-browser.js +1 -1
- package/dist/{fallback-Ctlj2tMY.d.cts → fallback-74oxi34l.d.cts} +1 -1
- package/dist/{fallback-CqYVLL6X.d.ts → fallback-DUyyBTBK.d.ts} +1 -1
- package/dist/graph/index.cjs +7 -7
- package/dist/graph/index.d.cts +5 -5
- package/dist/graph/index.d.ts +5 -5
- package/dist/graph/index.js +1 -1
- package/dist/{graph-C4SHb3Ly.d.cts → graph-CWvEUQAq.d.cts} +196 -3
- package/dist/{graph-7VguS7a4.d.ts → graph-D9LFnda9.d.ts} +196 -3
- package/dist/{index-LIpQQE9f.d.cts → index-5k1T6jl0.d.cts} +9 -9
- package/dist/{index-CPNSy-U0.d.cts → index-9770hRuQ.d.cts} +23 -4
- package/dist/{index-CEMx8n40.d.cts → index-B-_tFaqV.d.cts} +4 -4
- package/dist/{index-2B7u2pVn.d.cts → index-B17QddL1.d.cts} +4 -4
- package/dist/{index-B-i4_g3k.d.ts → index-B1F8Enjf.d.ts} +61 -8
- package/dist/{index-DBevwHj_.d.ts → index-B5S8ULbU.d.ts} +3 -3
- package/dist/{index-Dgs8zcj7.d.ts → index-B8YnZpIR.d.ts} +2 -2
- package/dist/{index-B3OTH1dV.d.ts → index-BHskSB8v.d.ts} +28 -17
- package/dist/{index-sl4NyzQx.d.cts → index-BIYAkbAi.d.cts} +1 -1
- package/dist/{index-C9kSENB4.d.cts → index-BQSKmbuG.d.cts} +1 -1
- package/dist/{index-tJoTcnHh.d.cts → index-BaQaY_IQ.d.cts} +2 -2
- package/dist/{index-CJK1JkYy.d.ts → index-BmZXHqkE.d.ts} +1 -1
- package/dist/{index-pT8sCpOJ.d.ts → index-BoJ5JHxI.d.ts} +12 -3
- package/dist/{index-BeT2r7sk.d.ts → index-BocU7pqs.d.ts} +23 -4
- package/dist/{index-ChOyVLKm.d.cts → index-BrPrLl4e.d.cts} +1 -1
- package/dist/{index-D-Xs74HZ.d.cts → index-BxNs2HB9.d.cts} +33 -9
- package/dist/{index-Bf7eqeSF.d.ts → index-Byu-OpX_.d.ts} +2 -2
- package/dist/{index-BoLv_OfD.d.cts → index-C1T3d7V-.d.cts} +61 -8
- package/dist/{index-BTQtTb_H.d.cts → index-C5ri2Axc.d.cts} +3 -3
- package/dist/{index-z96luz5O.d.cts → index-C5stwKcw.d.cts} +1 -1
- package/dist/{index-CZmcDtFn.d.ts → index-C9l6OEBL.d.ts} +1 -1
- package/dist/{index-CCq87F7t.d.ts → index-CBBLl_rc.d.ts} +1 -1
- package/dist/{index-D6egPFAL.d.ts → index-CBGUK09R.d.ts} +4 -4
- package/dist/{index-C0-Jv1kP.d.cts → index-CC-AvFTy.d.cts} +12 -3
- package/dist/{index-DQo8xBgd.d.ts → index-CJF1URuX.d.ts} +9 -9
- package/dist/{index-BJX94aud.d.cts → index-CK29LV56.d.cts} +1 -1
- package/dist/{index-BP8a88zx.d.ts → index-CMh5Rz1y.d.ts} +4 -4
- package/dist/{index-CvrqGfNS.d.ts → index-CPQlGA29.d.ts} +1 -1
- package/dist/{index-Bbkgpt5t.d.ts → index-CR8QpwX8.d.ts} +49 -24
- package/dist/{index-Du7u1lSf.d.cts → index-CS0LTlB8.d.cts} +4 -4
- package/dist/{index-Bc41FuHp.d.cts → index-CSOmP7xT.d.cts} +2 -2
- package/dist/{index-BsT7F2et.d.ts → index-CYq8vAyV.d.ts} +2 -2
- package/dist/{index-Bn4zHYLj.d.ts → index-CZ3r5Rxp.d.ts} +4 -4
- package/dist/{index-HoU88d5U.d.cts → index-CasX6Pfq.d.cts} +68 -9
- package/dist/{index-BG0BN3PB.d.ts → index-CdAlHFEt.d.ts} +1 -1
- package/dist/{index-CpyNFqkB.d.ts → index-CdTelp1M.d.ts} +8 -4
- package/dist/{index-D8l8hNXn.d.ts → index-CeFiHtAg.d.ts} +4 -4
- package/dist/{index-DmAgG5CI.d.cts → index-Cj3WohTd.d.cts} +8 -4
- package/dist/{index-BtAsBp8K.d.cts → index-Climxqsu.d.cts} +4 -4
- package/dist/{index-CJIuLu2f.d.cts → index-Co7uli2l.d.cts} +28 -17
- package/dist/{index-DIOoAZUX.d.ts → index-CviRnE4K.d.ts} +1 -1
- package/dist/{index-Dhc7a7Xo.d.cts → index-Cwv0KWcU.d.cts} +2 -2
- package/dist/{index-Dn-wI9g4.d.ts → index-CzLVrjxn.d.ts} +2 -2
- package/dist/{index-DO9XxMzS.d.ts → index-D0aciIex.d.cts} +3 -18
- package/dist/{index-4Uz-e_fL.d.ts → index-DHen9Klo.d.ts} +33 -9
- package/dist/{index-3NmAfcH0.d.cts → index-DV_1YuVk.d.cts} +40 -8
- package/dist/{index-BdGtBX-X.d.cts → index-Dc4AYqrJ.d.cts} +3 -3
- package/dist/{index-Dmqp7KjD.d.ts → index-Dgl1HpPn.d.ts} +1 -1
- package/dist/{index-CJQm0g38.d.ts → index-DisjX8a-.d.ts} +40 -8
- package/dist/{index-B11anra4.d.cts → index-UPSiS-X7.d.cts} +49 -24
- package/dist/{index-DBIqYS43.d.cts → index-Yq60JP3s.d.ts} +3 -18
- package/dist/{index-f5IivDUX.d.cts → index-ZVQhLa2i.d.cts} +1 -1
- package/dist/{index-hHcaFlJX.d.cts → index-_6ODbuOu.d.cts} +1 -1
- package/dist/{index-BVpm6noz.d.cts → index-hcDJ8PSI.d.cts} +1 -1
- package/dist/{index-DBHK8O6H.d.ts → index-nozs3fFC.d.ts} +3 -3
- package/dist/{index-BUYXac2c.d.ts → index-p09KSrTN.d.ts} +68 -9
- package/dist/{index-C7O6r5fV.d.ts → index-sqkqlb1p.d.ts} +1 -1
- package/dist/{index-CZjOhcBy.d.cts → index-tRCxuAXF.d.cts} +2 -2
- package/dist/index.cjs +48 -48
- package/dist/index.d.cts +42 -43
- package/dist/index.d.ts +42 -43
- package/dist/index.js +1 -1
- package/dist/{node-ClS5yC-B.d.cts → node-kK3CvTrR.d.cts} +1 -1
- package/dist/{node-ClS5yC-B.d.ts → node-kK3CvTrR.d.ts} +1 -1
- package/dist/{observable-BsBzUrcI.d.ts → observable-DWjNfLvC.d.ts} +1 -1
- package/dist/{observable-DLGPPtb8.d.cts → observable-e3eiPPFy.d.cts} +1 -1
- package/dist/patterns/ai/browser.cjs +5 -5
- package/dist/patterns/ai/browser.d.cts +4 -4
- package/dist/patterns/ai/browser.d.ts +4 -4
- package/dist/patterns/ai/browser.js +1 -1
- package/dist/patterns/ai/index.cjs +16 -16
- package/dist/patterns/ai/index.d.cts +16 -17
- package/dist/patterns/ai/index.d.ts +16 -17
- package/dist/patterns/ai/index.js +1 -1
- package/dist/patterns/ai/node.cjs +1 -1
- package/dist/patterns/ai/node.d.cts +4 -4
- package/dist/patterns/ai/node.d.ts +4 -4
- package/dist/patterns/ai/node.js +1 -1
- package/dist/patterns/cqrs/index.cjs +3 -3
- package/dist/patterns/cqrs/index.d.cts +6 -6
- package/dist/patterns/cqrs/index.d.ts +6 -6
- package/dist/patterns/cqrs/index.js +1 -1
- package/dist/patterns/demo-shell/index.cjs +5 -5
- package/dist/patterns/demo-shell/index.d.cts +5 -5
- package/dist/patterns/demo-shell/index.d.ts +5 -5
- package/dist/patterns/demo-shell/index.js +1 -1
- package/dist/patterns/domain-templates/index.cjs +3 -3
- package/dist/patterns/domain-templates/index.d.cts +4 -4
- package/dist/patterns/domain-templates/index.d.ts +4 -4
- package/dist/patterns/domain-templates/index.js +1 -1
- package/dist/patterns/graphspec/index.cjs +16 -16
- package/dist/patterns/graphspec/index.d.cts +5 -5
- package/dist/patterns/graphspec/index.d.ts +5 -5
- package/dist/patterns/graphspec/index.js +1 -1
- package/dist/patterns/harness/index.cjs +9 -9
- package/dist/patterns/harness/index.d.cts +10 -11
- package/dist/patterns/harness/index.d.ts +10 -11
- package/dist/patterns/harness/index.js +1 -1
- package/dist/patterns/inspect/index.cjs +3 -3
- package/dist/patterns/inspect/index.d.cts +7 -7
- package/dist/patterns/inspect/index.d.ts +7 -7
- package/dist/patterns/inspect/index.js +1 -1
- package/dist/patterns/job-queue/index.cjs +3 -3
- package/dist/patterns/job-queue/index.d.cts +6 -6
- package/dist/patterns/job-queue/index.d.ts +6 -6
- package/dist/patterns/job-queue/index.js +1 -1
- package/dist/patterns/memory/index.cjs +3 -3
- package/dist/patterns/memory/index.d.cts +6 -6
- package/dist/patterns/memory/index.d.ts +6 -6
- package/dist/patterns/memory/index.js +1 -1
- package/dist/patterns/messaging/index.cjs +3 -3
- package/dist/patterns/messaging/index.d.cts +5 -5
- package/dist/patterns/messaging/index.d.ts +5 -5
- package/dist/patterns/messaging/index.js +1 -1
- package/dist/patterns/orchestration/index.cjs +3 -3
- package/dist/patterns/orchestration/index.d.cts +6 -7
- package/dist/patterns/orchestration/index.d.ts +6 -7
- package/dist/patterns/orchestration/index.js +1 -1
- package/dist/patterns/process/index.cjs +3 -1
- package/dist/patterns/process/index.d.cts +7 -7
- package/dist/patterns/process/index.d.ts +7 -7
- package/dist/patterns/process/index.js +1 -1
- package/dist/patterns/reactive-layout/index.cjs +4 -4
- package/dist/patterns/reactive-layout/index.d.cts +5 -5
- package/dist/patterns/reactive-layout/index.d.ts +5 -5
- package/dist/patterns/reactive-layout/index.js +1 -1
- package/dist/patterns/reduction/index.cjs +3 -3
- package/dist/patterns/reduction/index.d.cts +4 -4
- package/dist/patterns/reduction/index.d.ts +4 -4
- package/dist/patterns/reduction/index.js +1 -1
- package/dist/patterns/surface/index.cjs +10 -10
- package/dist/patterns/surface/index.d.cts +6 -6
- package/dist/patterns/surface/index.d.ts +6 -6
- package/dist/patterns/surface/index.js +1 -1
- package/dist/{pipeline-graph-WBlobVhU.d.cts → pipeline-graph-CIKhynsF.d.cts} +11 -6
- package/dist/{pipeline-graph-v8fMvqNk.d.ts → pipeline-graph-Sgj0gCwn.d.ts} +11 -6
- package/dist/{reactive-layout-v7KPvxoc.d.ts → reactive-layout-DOTs9P3X.d.ts} +2 -2
- package/dist/{reactive-layout-Dsvob4zD.d.cts → reactive-layout-DgctbqZo.d.cts} +2 -2
- package/dist/{reactive-log-BezYsbA_.d.ts → reactive-log-BKALbfal.d.ts} +1 -1
- package/dist/{reactive-log-B00laMSQ.d.cts → reactive-log-DIGdYqQ6.d.cts} +1 -1
- package/dist/{reactive-map-48mnZ-nu.d.cts → reactive-map-CEFGp8TK.d.cts} +1 -1
- package/dist/{reactive-map-BVVPdvmi.d.ts → reactive-map-DS_SIAxv.d.ts} +1 -1
- package/dist/resilience-6LYQJAC5.js +1 -0
- package/dist/sugar-DQjFmVqb.d.cts +399 -0
- package/dist/sugar-fhLIE7TT.d.ts +399 -0
- package/dist/{topology-tree-BSdfSwMi.d.cts → topology-tree-Bcz27hpF.d.cts} +1 -1
- package/dist/{topology-tree-BNGvuG82.d.ts → topology-tree-xvaD0fOX.d.ts} +1 -1
- package/dist/{types-B1jDWVsM.d.cts → types-C0_yquda.d.cts} +1 -1
- package/dist/{types-DkzUUs0H.d.ts → types-CWFysE9E.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-3ERTUW2J.js +0 -45
- package/dist/chunk-3K7HA4Y6.js +0 -1
- package/dist/chunk-3ZZX7M25.js +0 -1
- package/dist/chunk-4I45FVQS.js +0 -1
- package/dist/chunk-5ST42ESJ.js +0 -1
- package/dist/chunk-7VKFXLZQ.js +0 -84
- package/dist/chunk-ACMJ2ZPS.js +0 -3
- package/dist/chunk-AS3TV2TV.js +0 -1
- package/dist/chunk-LPRWATHB.js +0 -61
- package/dist/chunk-LYCLF26R.js +0 -1
- package/dist/chunk-VE5SIZEM.js +0 -1
- package/dist/chunk-XLQPNNIC.js +0 -1
- package/dist/meta-BgVAsg9j.d.ts +0 -102
- package/dist/meta-vE8bxW1E.d.cts +0 -102
- package/dist/resilience-445VFFXQ.js +0 -1
- package/dist/sugar-CH-2ZY90.d.ts +0 -203
- package/dist/sugar-DStZfUEK.d.cts +0 -203
package/dist/extra/operators.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var se=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var ut=Object.getOwnPropertyNames;var dt=Object.prototype.hasOwnProperty;var R=(o,e)=>()=>(o&&(e=o(o=0)),e);var lt=(o,e)=>{for(var n in e)se(o,n,{get:e[n],enumerable:!0})},ct=(o,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of ut(e))!dt.call(o,t)&&t!==n&&se(o,t,{get:()=>e[t],enumerable:!(r=at(e,t))||r.enumerable});return o};var ft=o=>ct(se({},"__esModule",{value:!0}),o);function q(){return Math.trunc(performance.now()*1e6)}function ve(){return Date.now()*1e6}var ie=R(()=>{"use strict"});var C,m,M,g,F,L,W,I,c,p,G,ae,pt,ue,ht,mt,de,we,Ne,xe,le,B=R(()=>{"use strict";C=Symbol.for("graphrefly/START"),m=Symbol.for("graphrefly/DATA"),M=Symbol.for("graphrefly/DIRTY"),g=Symbol.for("graphrefly/RESOLVED"),F=Symbol.for("graphrefly/INVALIDATE"),L=Symbol.for("graphrefly/PAUSE"),W=Symbol.for("graphrefly/RESUME"),I=Symbol.for("graphrefly/TEARDOWN"),c=Symbol.for("graphrefly/COMPLETE"),p=Symbol.for("graphrefly/ERROR"),G=Object.freeze([M]),ae=Object.freeze([g]),pt=Object.freeze([F]),ue=Object.freeze([C]),ht=Object.freeze([c]),mt=Object.freeze([I]),de=Object.freeze([G]),we=Object.freeze([ae]),Ne=Object.freeze([pt]),xe=Object.freeze([ht]),le=Object.freeze([mt])});var P,ke=R(()=>{"use strict";P=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 Ee(o){o.registerCodec(gt)}var gt,Oe=R(()=>{"use strict";gt={name:"json",version:1,contentType:"application/json",encode(o){let e=JSON.stringify(o);return new TextEncoder().encode(e)},decode(o,e){let n=new TextDecoder().decode(o);return JSON.parse(n)}}});function Y(o){if(o==null)return bt;let{type:e,id:n,...r}=o;return{type:e??"system",id:n??"",...r}}var bt,Ae=R(()=>{"use strict";bt={type:"system",id:""}});function Se(){return ce>0||Tt}function Ce(){return ce>0}function Ie(o){ce>0?_t.push(o):o()}function J(o,e,n){if(e.length===0)return;if(e.length===1){let d=n(e[0][0]);if(d<3||!Se()){o(e);return}(d>=5?De:d===4?Me:Re).push(()=>o(e));return}let r=e.length,t=r,s=r,a=r,i=0;for(;i<r&&n(e[i][0])<3;)i++;for(t=i;i<r&&n(e[i][0])===3;)i++;for(s=i;i<r&&n(e[i][0])===4;)i++;a=i;let u=Se();if(t>0){let d=e.slice(0,t);o(d)}if(s>t){let d=e.slice(t,s);u?Re.push(()=>o(d)):o(d)}if(a>s){let d=e.slice(s,a);u?Me.push(()=>o(d)):o(d)}if(r>a){let d=e.slice(a,r);u?De.push(()=>o(d)):o(d)}}var ce,Tt,Re,Me,De,_t,Fe=R(()=>{"use strict";ce=0,Tt=!1,Re=[],Me=[],De=[],_t=[]});function Le(o){o.registerMessageType(C,{tier:0,wireCrossing:!1}),o.registerMessageType(M,{tier:1,wireCrossing:!1}),o.registerMessageType(F,{tier:1,wireCrossing:!1,metaPassthrough:!1}),o.registerMessageType(L,{tier:2,wireCrossing:!1}),o.registerMessageType(W,{tier:2,wireCrossing:!1}),o.registerMessageType(m,{tier:3,wireCrossing:!0}),o.registerMessageType(g,{tier:3,wireCrossing:!0}),o.registerMessageType(c,{tier:4,wireCrossing:!0,metaPassthrough:!1}),o.registerMessageType(p,{tier:4,wireCrossing:!0,metaPassthrough:!1}),o.registerMessageType(I,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var X,Ge=R(()=>{"use strict";B();X=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_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}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=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 fe(o){if(o===void 0)return null;if(typeof o=="number"){if(!Number.isFinite(o))throw new TypeError(`Cannot hash non-finite number: ${o}`);if(Number.isInteger(o)&&!Number.isSafeInteger(o))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${o}. Cross-language cid parity is not guaranteed for unsafe integers.`);return o}if(typeof o=="string"||typeof o=="boolean"||o===null)return o;if(Array.isArray(o))return o.map(fe);if(typeof o=="object"&&o!==null){let e={};for(let n of Object.keys(o).sort())e[n]=fe(o[n]);return e}return null}function wt(o){let e=vt.encode(o),n=e.length,r=n*8,t=n+9+63&-64,s=new Uint8Array(t);s.set(e),s[n]=128;let a=new DataView(s.buffer);a.setUint32(t-4,r>>>0,!1),a.setUint32(t-8,Math.floor(r/4294967296)>>>0,!1);let i=1779033703,u=3144134277,d=1013904242,l=2773480762,f=1359893119,_=2600822924,T=528734635,w=1541459225,O=new Uint32Array(64),v=(A,x)=>A>>>x|A<<32-x;for(let A=0;A<t;A+=64){for(let k=0;k<16;k++)O[k]=a.getUint32(A+k*4,!1);for(let k=16;k<64;k++){let U=O[k-15],H=O[k-2],K=v(U,7)^v(U,18)^U>>>3,oe=v(H,17)^v(H,19)^H>>>10;O[k]=O[k-16]+K+O[k-7]+oe>>>0}let x=i,D=u,V=d,ne=l,S=f,z=_,$=T,re=w;for(let k=0;k<64;k++){let U=v(S,6)^v(S,11)^v(S,25),H=S&z^~S&$,K=re+U+H+yt[k]+O[k]>>>0,oe=v(x,2)^v(x,13)^v(x,22),st=x&D^x&V^D&V,it=oe+st>>>0;re=$,$=z,z=S,S=ne+K>>>0,ne=V,V=D,D=x,x=K+it>>>0}i=i+x>>>0,u=u+D>>>0,d=d+V>>>0,l=l+ne>>>0,f=f+S>>>0,_=_+z>>>0,T=T+$>>>0,w=w+re>>>0}let N=A=>A.toString(16).padStart(8,"0");return N(i)+N(u)+N(d)+N(l)+N(f)+N(_)+N(T)+N(w)}function pe(o){let e=fe(o??null),n=JSON.stringify(e);return wt(n).slice(0,16)}function Nt(){let o=globalThis.crypto;if(o?.randomUUID)return o.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 he(o,e,n){let r=n?.id??Nt();if(o===0)return{id:r,version:0};let s=(n?.hash??pe)(e);return{id:r,version:0,cid:s,prev:null}}function Pe(o,e,n){o.version+=1,"cid"in o&&(o.prev=o.cid,o.cid=n(e))}var yt,vt,Ve=R(()=>{"use strict";yt=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]),vt=new TextEncoder});function We(o){return{node:o,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function me(o){o.prevData=void 0,o.dirty=!1,o.involvedThisWave=!1,o.dataBatch.length=0,o.terminal=void 0}function Z(o){return o.length===0?o:typeof o[0]=="symbol"?[o]:o}function y(o,e,n){let r=Be(o)?o:[],t=typeof o=="function"?o:typeof e=="function"?e:void 0,s={};return Be(o)?s=(ge(e)?e:n)??{}:ge(o)?s=o:s=(ge(e)?e:n)??{},new Q(r,t,s)}var Ue,He,xt,kt,be,Q,Be,ge,Te=R(()=>{"use strict";Oe();Ae();Fe();ie();Ge();ke();B();Ve();Ue=()=>{},He=100;xt=(o,e,n,r)=>{n.direction==="down-in"&&o._onDepMessage(n.depIndex,e)},kt=(o,e,n,r)=>{let t=o;if(t._status==="completed"||t._status==="errored")return;let s=t._cached,a=s===void 0?[ue]:[ue,[m,s]];t._status==="dirty"&&a.push(G),J(e,a,t._config.tierOf)},be=new X({onMessage:xt,onSubscribe:kt});Le(be);Ee(be);Q=class o{_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??be,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??pe;let t=r.versioning??this._config.defaultVersioning;this._versioningLevel=t,this._versioning=t!=null?he(t,this._cached===void 0?void 0:this._cached,{id:r.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(We);let s={};for(let[i,u]of Object.entries(r.meta??{})){let d={initial:u,name:`${r.name??"node"}:meta:${i}`,describeKind:"state",config:this._config};r.guard!=null&&(d.guard=r.guard),s[i]=new o([],void 0,d)}Object.freeze(s),this.meta=s,this._hasMeta=Object.keys(s).length>0;let a=this;this._actions={emit(i){a._emit([[m,i]])},down(i){a._emit(Z(i))},up(i){a._emitUp(Z(i))}},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 t=n?.hash??this._hashFn;t!==this._hashFn&&(this._hashFn=t);let s=this._cached===void 0?void 0:this._cached,a=this._versioning,i=a?.id??n?.id,u=a?.version??0,d=he(e,s,{id:i,hash:t});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=Y(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 t=Y(e?.actor),s=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(t,s))throw new P({actor:t,action:s,nodeName:this.name});if(this._extraGuards!=null){for(let a of this._extraGuards)if(!a(t,s))throw new P({actor:t,action:s,nodeName:this.name})}this._lastMutation={actor:t,timestamp_ns:ve()}}down(e,n){let r=Z(e);r.length!==0&&(this._checkGuard(n),this._emit(r))}emit(e,n){this._checkGuard(n),this._emit([[m,e]])}up(e,n){if(this._deps.length===0)return;let r=Z(e);if(r.length===0)return;this._checkGuard(n);let t=n??{internal:!0};this._validateUpTiers(r);for(let s of this._deps)s.node.up?.(r,t)}_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 t=n(r[0]);if(t===3||t===4)throw new Error(`Node "${this.name}": tier-${t} 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=Y(n);if(!this._guard(u,"observe"))throw new P({actor:u,action:"observe",nodeName:this.name})}let t=this._isTerminal&&this._resubscribable;if(t){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 s;try{s=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:t},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 a=this._isTerminal;if(this._sinkCount===1&&!a)try{this._activate()}catch(u){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof s=="function")try{s()}catch{}throw u}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let i=!1;return()=>{i||(i=!0,this._sinkCount-=1,this._removeSink(e),typeof s=="function"&&s(),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 t=r,s=this._deps[r];s.unsub=Ue,s.unsub=s.node.subscribe(a=>{if(s.unsub===null)return;let i=this._config.tierOf,u=!1;for(let d of a)i(d[0])>=3&&(u=!0),this._config.onMessage(this,d,{direction:"down-in",depIndex:t},this._actions);u&&this._maybeRunFnOnSettlement()}),n++}}catch(r){this._deps[n].unsub=null;for(let t=0;t<n;t++){let s=this._deps[t];if(s.unsub!=null){let a=s.unsub;s.unsub=null;try{a()}catch{}me(s)}}throw this._dirtyDepCount=0,r}}_addDep(e){for(let t=0;t<this._deps.length;t++)if(this._deps[t].node===e)return t;let n=this._deps.length,r=We(e);if(this._deps.push(r),this._sinks==null)return n;r.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(de),r.unsub=Ue;try{r.unsub=e.subscribe(t=>{if(r.unsub===null)return;let s=this._config.tierOf,a=!1;for(let i of t)s(i[0])>=3&&(a=!0),this._config.onMessage(this,i,{direction:"down-in",depIndex:n},this._actions);a&&this._maybeRunFnOnSettlement()})}catch(t){throw r.unsub=null,this._deps.pop(),this._dirtyDepCount--,t}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(t){this._emit([[p,this._wrapFnError("cleanup.deactivate threw",t)]])}}for(let r of this._deps){if(r.unsub!=null){let t=r.unsub;r.unsub=null;try{t()}catch{}}me(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],t=n[0];if(this._inspectorHooks!=null){let s={kind:"dep_message",depIndex:e,message:n};for(let a of this._inspectorHooks)a(s)}if(t!==C){if(t===M){this._depDirtied(r);return}if(t===F){if(this._depInvalidated(r),this._cached===void 0)return;this._emit(Ne);return}if(t===L||t===W){this._emit([n]);return}if(t===I){this._emit(le);return}if(t===m)this._depSettledAsData(r,n[1]);else if(t===g)this._depSettledAsResolved(r);else if(t===c)this._depSettledAsTerminal(r,!0);else if(t===p)this._depSettledAsTerminal(r,n[1]);else{this._emit([n]);return}if(!this._fn){(t===m||t===g)&&this._emit([n]),(t===c||t===p)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(de))}_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(we),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(xe)}_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(a){this._emit([[p,this._wrapFnError("cleanup threw",a)]]);return}}else if(e!=null&&typeof e=="object"){let a=e.beforeRun;if(typeof a=="function"){e.beforeRun=void 0;try{a()}catch(i){this._emit([[p,this._wrapFnError("cleanup.beforeRun threw",i)]]);return}}}let n=this._deps.map(a=>a.involvedThisWave?a.dataBatch.length>0?[...a.dataBatch]:[]:void 0),r=this._deps.map(a=>a.prevData);for(let a=0;a<this._deps.length;a++){let i=n[a];i!=null&&i.length>0&&(this._deps[a].prevData=i[i.length-1])}let t=this._deps.map(a=>a.terminal),s={prevData:r,terminalDeps:t,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let a={kind:"run",batchData:n,prevData:r};for(let i of this._inspectorHooks)i(a)}this._isExecutingFn=!0;try{let a=this._fn(n,this._actions,s);if(typeof a=="function")this._cleanup=a;else if(a!=null&&typeof a=="object"){let i=a;(typeof i.beforeRun=="function"||typeof i.deactivate=="function"||typeof i.invalidate=="function")&&(this._cleanup=a)}}catch(a){this._emit([[p,this._wrapFnError("fn threw",a)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>He?(this._rerunDepth=0,this._emit([[p,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${He} \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"?[G,e[0]]:e;let r=!0,t=!1,s=!1,a=-1;for(let u of e){let d=n(u[0]);d<a&&(r=!1),d===3&&(t=!0),u[0]===M&&(s=!0),a=d}let i=e;if(!r){let u=e.map((d,l)=>({m:d,i:l,tier:n(d[0])}));u.sort((d,l)=>d.tier-l.tier||d.i-l.i),i=u.map(d=>d.m)}if(t&&!s&&this._status!=="dirty"){let u=0;for(;u<i.length&&n(i[u][0])===0;)u++;return u===0?[G,...i]:[...i.slice(0,u),G,...i.slice(u)]}return i}_emit(e){if(e.length===0)return;for(let i=0;i<e.length;i++){let u=e[i];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 i=e.filter(u=>u[0]===I||u[0]===F);if(i.length===0)return;n=i}n=this._frameBatch(n);let t=null;for(let i=0;i<n.length;i++){let u=n[i],d=u[0];if(d!==L&&d!==W){t?.push(u);continue}if(u.length<2)throw new Error(`Node "${this.name}": [[${d===L?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let l=!0;if(this._pausable!==!1){let f=u[1];if(d===L)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(f),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(f))l=!1;else if(this._pauseLocks.delete(f),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let _=this._pauseBuffer;this._pauseBuffer=[],this._emit(_)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}l?t?.push(u):t==null&&(t=n.slice(0,i))}if(t!=null){if(t.length===0)return;n=t}if(this._hasMeta&&n.some(i=>i[0]===I))for(let i of Object.keys(this.meta))try{this.meta[i]._emit(le)}catch{}let{finalMessages:s,equalsError:a}=this._updateState(n);if(s.length>0&&this._config.inspectorEnabled){let i=this._config.globalInspector;if(i!=null)try{i({kind:"emit",node:this,messages:s})}catch{}}if(s.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let i=this._config.tierOf,u=[];for(let d of s)i(d[0])===3?this._pauseBuffer.push(d):u.push(d);u.length>0&&this._dispatchOrAccumulate(u)}else this._dispatchOrAccumulate(s);a!=null&&this._emit([[p,a]])}_updateState(e){let n=this._config.tierOf,r,t,s=-1,a=0;for(let l of e)n(l[0])===3&&a++;let i=a<=1,u=-1;if(this._versioning!=null&&a>1){for(let l=e.length-1;l>=0;l--)if(e[l][0]===m){u=l;break}}for(let l=0;l<e.length;l++){let f=e[l],_=f[0];if(_===m){if(f.length>=2){let T=!1;if(i&&this._cached!==void 0)try{T=this._equals(this._cached,f[1])}catch(w){t=this._wrapFnError("equals threw",w),s=l;break}if(T){r==null&&(r=e.slice(0,l)),r.push(ae),this._status="resolved";continue}this._cached=f[1],this._versioning!=null&&(u<0||l===u)&&Pe(this._versioning,f[1],this._hashFn)}this._status="settled",r?.push(f)}else if(r?.push(f),_===M)this._status="dirty";else if(_===g)this._status="resolved";else if(_===c){this._status="completed";{let T=this._config.rigorRecorder;if(T!=null)try{T.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(_===p){this._status="errored";{let T=this._config.rigorRecorder;if(T!=null)try{T.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(_===F){if(this._cached!==void 0){let w=this._config.rigorRecorder;if(w!=null)try{w.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let T=this._cleanup;if(typeof T=="function"){this._cleanup=void 0;try{T()}catch{}}else if(T!=null&&typeof T=="object"){let w=T.invalidate;if(typeof w=="function")try{w()}catch{}}}else _===I&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let d=s>=0?r??e.slice(0,s):r??e;return t!=null?{finalMessages:d,equalsError:t}:{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(Ce()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Ie(()=>this._flushBatchPending()));for(let n of e)this._batchPendingMessages.push(n);return}J(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);J(this._deliverToSinks,n,this._config.tierOf)}},Be=o=>Array.isArray(o),ge=o=>typeof o=="object"&&o!=null&&!Array.isArray(o)});function E(o,e){let n={factory:o};return e!==void 0&&(n.factoryArgs=e),n}var je=R(()=>{"use strict"});function b(o,e){return y((r,t,s)=>o(t,s)??void 0,{describeKind:"producer",...e})}function ze(o,e,n){return y(o,(t,s,a)=>{let i=t.map((u,d)=>u!=null&&u.length>0?u.at(-1):a.prevData[d]);s.emit(e(i,a))},{describeKind:"derived",...n})}var _e=R(()=>{"use strict";Te()});function ye(o){return{describeKind:"producer",...o}}function $e(o,e){return b(n=>{let r=!1;try{for(let t of o){if(r)return;n.emit(t)}r||n.down([[c]])}catch(t){r||n.down([[p,t]])}return()=>{r=!0}},ye(e))}function Et(o){return o!=null&&typeof o.then=="function"}function Ot(o,e){let{signal:n,...r}=e??{};return b(t=>{let s=!1,a=()=>{s||(s=!0,t.down([[p,n.reason]]))};if(n?.aborted){a();return}return n?.addEventListener("abort",a,{once:!0}),Promise.resolve(o).then(i=>{s||(s=!0,n?.removeEventListener("abort",a),t.emit(i),t.down([[c]]))},i=>{s||(s=!0,n?.removeEventListener("abort",a),t.down([[p,i]]))}),()=>{s=!0,n?.removeEventListener("abort",a)}},ye(r))}function At(o,e){let{signal:n,...r}=e??{};return b(t=>{let s=new AbortController,a=()=>s.abort(n?.reason);n?.aborted?s.abort(n.reason):n?.addEventListener("abort",a,{once:!0});let i=n??s.signal,u=!1,d=o[Symbol.asyncIterator](),l=()=>{u||i.aborted||Promise.resolve(d.next()).then(f=>{if(!(u||i.aborted)){if(f.done){t.down([[c]]);return}t.emit(f.value),l()}},f=>{!u&&!i.aborted&&t.down([[p,f]])})};return l(),()=>{u=!0,n?.removeEventListener("abort",a),s.abort(),Promise.resolve(d.return?.()).catch(()=>{})}},ye(r))}function Rt(o){return o!=null&&typeof o=="object"&&"cache"in o&&typeof o.subscribe=="function"}function j(o,e){if(Rt(o))return o;if(Et(o))return Ot(o,e);if(o!=null){let n=o;if(typeof n[Symbol.asyncIterator]=="function")return At(o,e);if(typeof n[Symbol.iterator]=="function")return $e(o,e)}return Mt(o)}function Mt(...o){return $e(o,void 0)}var Ke=R(()=>{"use strict";B();_e()});var qe=R(()=>{"use strict";Ke()});function h(o){return{describeKind:"derived",...o}}function Ye(o){return{describeKind:"derived",partial:!0,...o}}function St(o,e,n){return y([o],(r,t)=>{let s=r[0];if(s==null||s.length===0){t.down([[g]]);return}for(let a of s)t.emit(e(a))},{...h(n),meta:{...E("map"),...n?.meta??{}}})}function Je(o,e,n){return y([o],(r,t)=>{let s=r[0];if(s==null||s.length===0){t.down([[g]]);return}let a=!1;for(let i of s)e(i)&&(t.emit(i),a=!0);a||t.down([[g]])},{...h(n),meta:{...E("filter"),...n?.meta??{}}})}function Ct(o,e,n,r){return y([o],(t,s,a)=>{"acc"in a.store||(a.store.acc=n);let i=t[0];if(i==null||i.length===0){s.down([[g]]);return}for(let u of i)a.store.acc=e(a.store.acc,u),s.emit(a.store.acc)},{...h(r),initial:n,resetOnTeardown:!0,meta:{...E("scan",{initial:n}),...r?.meta??{}}})}function It(o,e,n,r){return y([o],(t,s,a)=>{if("acc"in a.store||(a.store.acc=n),a.terminalDeps[0]===!0){s.emit(a.store.acc),s.down([[c]]);return}let i=t[0];if(i==null||i.length===0){s.down([[g]]);return}for(let u of i)a.store.acc=e(a.store.acc,u)},{...h(r),completeWhenDepsComplete:!1,meta:{...E("reduce",{initial:n}),...r?.meta??{}}})}function ee(o,e,n){return e<=0?y([o],(r,t,s)=>{s.store.completed||(s.store.completed=!0,t.down([[c]]))},{...h(n),completeWhenDepsComplete:!1,meta:{...E("take",{count:e}),...n?.meta??{}}}):y([o],(r,t,s)=>{if("taken"in s.store||(s.store.taken=0),s.store.done){t.down([[g]]);return}if(s.terminalDeps[0]===!0){s.store.done=!0,t.down([[c]]);return}let a=r[0];if(a==null||a.length===0){t.down([[g]]);return}for(let i of a)if(s.store.taken++,t.emit(i),s.store.taken>=e){s.store.done=!0,t.down([[c]]);return}},{...h(n),completeWhenDepsComplete:!1,meta:{...E("take",{count:e}),...n?.meta??{}}})}function Xe(o,e,n){return y([o],(r,t,s)=>{"skipped"in s.store||(s.store.skipped=0);let a=r[0];if(a==null||a.length===0){t.down([[g]]);return}let i=!1;for(let u of a)s.store.skipped++,s.store.skipped<=e||(t.emit(u),i=!0);i||t.down([[g]])},h(n))}function Ft(o,e,n){return y([o],(r,t,s)=>{if(s.store.done){t.down([[g]]);return}let a=r[0];if(a==null||a.length===0){t.down([[g]]);return}for(let i of a){if(!e(i)){s.store.done=!0,t.down([[c]]);return}t.emit(i)}},{...h(n),completeWhenDepsComplete:!1})}function Lt(o,e,n){let r=n?.predicate??(a=>a[0]===m),{predicate:t,...s}=n??{};return b(a=>{let i=!1,u=o.subscribe(l=>{if(!i)for(let f of l){if(i)return;f[0]===m?a.emit(f[1]):(f[0]===c||f[0]===p)&&(i=!0,a.down([f]))}}),d=e.subscribe(l=>{if(!i)for(let f of l){if(i)return;if(r(f)){i=!0,a.down([[c]]);return}}});return()=>{u(),d()}},h(s))}function Gt(o,e){return ee(o,1,e)}function Pt(o,e){let{defaultValue:n,...r}=e??{},t=e!=null&&Object.hasOwn(e,"defaultValue");return y([o],(s,a,i)=>{if(i.terminalDeps[0]===!0){i.store.has?a.emit(i.store.latest):t&&a.emit(n),a.down([[c]]);return}let u=s[0];if(u==null||u.length===0){a.down([[g]]);return}i.store.latest=u.at(-1),i.store.has=!0},{...h(r),completeWhenDepsComplete:!1})}function Vt(o,e,n){return ee(Je(o,e,n),1,n)}function Ut(o,e,n){return ee(Xe(o,e,n),1,n)}function Ht(o,e,n){if(typeof e=="function")return y([o],(t,s)=>{let a=t[0];if(a==null||a.length===0){s.down([[g]]);return}for(let i of a)e(i),s.emit(i)},{...h(n),meta:{...E("tap"),...n?.meta??{}}});let r=e;return y([o],(t,s,a)=>{if(a.terminalDeps[0]!==void 0){a.terminalDeps[0]===!0?(r.complete?.(),s.down([[c]])):(r.error?.(a.terminalDeps[0]),s.down([[p,a.terminalDeps[0]]]));return}let i=t[0];if(i==null||i.length===0){s.down([[g]]);return}for(let u of i)r.data?.(u),s.emit(u)},{...h(n),completeWhenDepsComplete:!1,meta:{...E("tap"),...n?.meta??{}}})}function Ze(o,e,n){let r=n?.where??(s=>s!=null),t=!1;return y([o],(s,a)=>{let i=s[0];if(i==null||i.length===0){a.down([[g]]);return}for(let u of i)!t&&r(u)&&(t=!0,e(u)),a.emit(u)},h(n))}function Bt(o,e=Object.is,n){return y([o],(r,t,s)=>{let a=r[0];if(a==null||a.length===0){t.down([[g]]);return}let i=!1;for(let u of a)s.store.hasPrev&&e(s.store.prev,u)||(s.store.prev=u,s.store.hasPrev=!0,t.emit(u),i=!0);i||t.down([[g]])},{...h(n),meta:{...E("distinctUntilChanged"),...n?.meta??{}}})}function jt(o,e){return y([o],(n,r,t)=>{let s=n[0];if(s==null||s.length===0){r.down([[g]]);return}let a=!1;for(let i of s)if(!t.store.hasPrev)t.store.prev=i,t.store.hasPrev=!0;else{let u=[t.store.prev,i];t.store.prev=i,r.emit(u),a=!0}a||r.down([[g]])},h(e))}function Qe(...o){let e=[...o];return ze(e,n=>n,{...h(),equals:(n,r)=>{if(n.length!==r.length)return!1;for(let t=0;t<n.length;t++)if(!Object.is(n[t],r[t]))return!1;return!0}})}function zt(o,e,n){return y([o,e],(r,t,s)=>{let a=r[0],i=r[1],u=i!=null&&i.length>0?i.at(-1):s.prevData[1];if(a!=null&&a.length>0){if(!(i!=null&&i.length>0)&&s.prevData[1]===void 0){t.down([[g]]);return}for(let d of a)t.emit([d,u])}else t.down([[g]])},{...Ye(n),meta:{...E("withLatestFrom"),...n?.meta??{}}})}function $t(...o){return o.length===0?b(e=>{e.down([[c]])},{...h(),meta:{...E("merge")}}):b(e=>{let n=o.length,r=0,t=[];for(let s of o){let a=s.subscribe(i=>{for(let u of i)u[0]===m?e.emit(u[1]):u[0]===c?(r+=1,r>=n&&e.down([[c]])):u[0]===p&&e.down([u])});t.push(a)}return()=>{for(let s of t)s()}},{...h(),meta:{...E("merge")}})}function Kt(...o){let e=o.length;return e===0?b(n=>{n.emit([]),n.down([[c]])},h()):b(n=>{let r=Array.from({length:e},()=>[]),t=e;function s(){for(;r.every(i=>i.length>0);){let i=r.map(u=>u.shift());n.emit(i)}}let a=[];for(let i=0;i<e;i++){let u=i,d=o[i].subscribe(l=>{for(let f of l)f[0]===m?(r[u].push(f[1]),s()):f[0]===c?(t-=1,(t===0||r[u].length===0)&&n.down([[c]])):f[0]===p&&n.down([f])});a.push(d)}return()=>{for(let i of a)i()}},h())}function qt(o,e,n){return b(r=>{let t=0,s=[],a,i;return i=e.subscribe(u=>{for(let d of u)t===0?d[0]===m?s.push(d[1]):d[0]===p&&r.down([d]):d[0]===m?r.emit(d[1]):(d[0]===c||d[0]===p)&&r.down([d])}),a=o.subscribe(u=>{for(let d of u)if(t===0)if(d[0]===m)r.emit(d[1]);else if(d[0]===c){t=1;for(let l of s)r.emit(l);s.length=0}else d[0]===p&&r.down([d])}),()=>{a?.(),i?.()}},h(n))}function Yt(...o){return o.length===0?b(e=>{e.down([[c]])},h()):o.length===1?y([o[0]],(e,n)=>{let r=e[0];if(r==null||r.length===0){n.down([[g]]);return}for(let t of r)n.emit(t)},h()):b(e=>{let n=null,r=[];for(let t=0;t<o.length;t++){let s=t,a=o[t].subscribe(i=>{for(let u of i){if(n!==null&&s!==n)return;u[0]===m?(n===null&&(n=s),e.emit(u[1])):(u[0]===c||u[0]===p)&&(n===null||s===n)&&e.down([u])}});r.push(a)}return()=>{for(let t of r)t()}},h())}function te(o,e,n){let r,t=!1,s=()=>{t||(t=!0,n())};return r=o.subscribe(a=>{let i=!1,u=!1;for(let d of a)d[0]!==C&&(d[0]===m?e.emit(d[1]):d[0]===c?i=!0:d[0]===p?(u=!0,e.down([d])):(d[0]===M||d[0]===g)&&e.down([d]));u?(r?.(),r=void 0,s()):i&&s()}),()=>{r?.(),r=void 0}}function Jt(o,e,n){let r,t=!1;function s(){r?.(),r=void 0}return y([o],(a,i,u)=>{if(u.terminalDeps[0]!=null&&u.terminalDeps[0]!==!0){s();return}if(u.terminalDeps[0]===!0){t=!0,r||i.down([[c]]);return}let d=a[0];if(!(d==null||d.length===0))return s(),r=te(j(e(d[d.length-1])),i,()=>{s(),t&&i.down([[c]])}),{deactivate:()=>{s(),t=!1}}},{...h(n),completeWhenDepsComplete:!1,meta:{...E("switchMap"),...n?.meta??{}}})}function Xt(o,e,n){let r,t=!1;function s(){r?.(),r=void 0}return y([o],(a,i,u)=>{if(u.terminalDeps[0]!=null&&u.terminalDeps[0]!==!0){s();return}if(u.terminalDeps[0]===!0){t=!0,r||i.down([[c]]);return}let d=a[0];if(!(d==null||d.length===0))return r===void 0?r=te(j(e(d[0])),i,()=>{s(),t&&i.down([[c]])}):i.down([[g]]),{deactivate:()=>{s(),t=!1}}},{...h(n),completeWhenDepsComplete:!1})}function Zt(o,e,n){let{maxBuffer:r,...t}=n??{},s=[],a,i=!1,u;function d(){a?.(),a=void 0}function l(){if(!u||a!==void 0)return;if(s.length===0){i&&u.down([[c]]);return}let _=s.shift();a=te(j(e(_)),u,()=>{d(),l()})}function f(_){r&&r>0&&s.length>=r&&s.shift(),s.push(_),l()}return y([o],(_,T,w)=>{if(u=T,w.terminalDeps[0]!=null&&w.terminalDeps[0]!==!0){d(),s.length=0;return}if(w.terminalDeps[0]===!0){i=!0,l();return}let O=_[0];if(!(O==null||O.length===0)){for(let v of O)f(v);return{deactivate:()=>{d(),s.length=0,i=!1}}}},{...h(t),completeWhenDepsComplete:!1})}function et(o,e,n){let{concurrent:r,...t}=n??{},s=r!=null&&r>0?r:Number.POSITIVE_INFINITY,a=0,i=!1,u=new Set,d=[],l;function f(){i&&a===0&&d.length===0&&l&&l.down([[c]])}function _(v){if(!l)return;a++;let N;N=te(j(e(v)),l,()=>{N&&u.delete(N),a--,T(),f()}),u.add(N)}function T(){for(;d.length>0&&a<s;)_(d.shift())}function w(v){a<s?_(v):d.push(v)}function O(){for(let v of u)v();u.clear(),a=0,d.length=0}return y([o],(v,N,A)=>{if(l=N,A.terminalDeps[0]!=null&&A.terminalDeps[0]!==!0){O();return}if(A.terminalDeps[0]===!0){i=!0,f();return}let x=v[0];if(!(x==null||x.length===0)){for(let D of x)w(D);return{deactivate:()=>{O(),i=!1}}}},{...h(t),completeWhenDepsComplete:!1})}function en(o,e,n){return b(r=>{let t=new Set;function s(){for(let i of t)clearTimeout(i);t.clear()}let a=o.subscribe(i=>{for(let u of i)if(u[0]===m){let d=setTimeout(()=>{t.delete(d),r.emit(u[1])},e);t.add(d)}else if(u[0]===c){let d=setTimeout(()=>{t.delete(d),r.down([[c]])},e);t.add(d)}else u[0]===p&&(s(),r.down([u]))});return()=>{a(),s()}},h(n))}function tt(o,e,n){return b(r=>{let t,s;function a(){t!==void 0&&(clearTimeout(t),t=void 0)}let i=o.subscribe(u=>{for(let d of u)d[0]===m?(a(),s=d[1],t=setTimeout(()=>{t=void 0,r.emit(s)},e)):d[0]===c?(t!==void 0&&(a(),r.emit(s)),r.down([[c]])):d[0]===p&&(a(),r.down([d]))});return()=>{i(),a()}},{...h(n),meta:{...E("debounce",{ms:e}),...n?.meta??{}}})}function nt(o,e,n){let{leading:r,trailing:t,...s}=n??{},a=r!==!1,i=t===!0,u=e*1e6;return b(d=>{let l,f=-1/0,_,T=!1;function w(){l!==void 0&&(clearTimeout(l),l=void 0)}let O=o.subscribe(v=>{for(let N of v)if(N[0]===m){let A=N[1],x=q();if(a&&x-f>=u)f=x,d.emit(A),w(),i&&(l=setTimeout(()=>{l=void 0,T&&(f=q(),d.emit(_),T=!1)},e));else if(i&&(_=A,T=!0,l===void 0)){let D=(x-f)/1e6;l=setTimeout(()=>{l=void 0,T&&(f=q(),d.emit(_),T=!1)},Math.max(0,e-D))}}else(N[0]===c||N[0]===p)&&(w(),d.down([N]))});return()=>{O(),w()}},{...h(s),meta:{...E("throttle",{ms:e,leading:a,trailing:i}),...s.meta??{}}})}function tn(o,e,n){return b(r=>{let t,s=!1,a=!1,i=o.subscribe(d=>{if(!s)for(let l of d){if(s)return;l[0]===m?t={v:l[1]}:l[0]===p?(s=!0,r.down([l])):l[0]===c&&(a=!0,t=void 0)}}),u=e.subscribe(d=>{if(!s)for(let l of d){if(s)return;l[0]===m?t!==void 0&&!a&&r.emit(t.v):l[0]===p?(s=!0,r.down([l])):l[0]===c&&(s=!0,r.down([[c]]))}});return()=>{i(),u()}},h(n))}function nn(o,e,n){return b(r=>{let t,s,a=!1;function i(){t!==void 0&&(clearTimeout(t),t=void 0)}let u=o.subscribe(d=>{for(let l of d)l[0]===m?(s=l[1],a=!0,i(),t=setTimeout(()=>{t=void 0,a&&(a=!1,r.emit(s))},e)):(l[0]===c||l[0]===p)&&(i(),r.down([l]))});return()=>{u(),i()}},h(n))}function rn(o,e,n){let{with:r,...t}=n??{},s=r??new Error("timeout");return b(a=>{let i;function u(){clearTimeout(i),i=setTimeout(()=>{i=void 0,a.down([[p,s]])},e)}u();let d=o.subscribe(l=>{for(let f of l)f[0]===m?(u(),a.emit(f[1])):(f[0]===c||f[0]===p)&&(clearTimeout(i),a.down([f]))});return()=>{d(),clearTimeout(i)}},h(t))}function on(o,e,n){return b(r=>{let t=[],s=o.subscribe(i=>{for(let u of i)u[0]===m?t.push(u[1]):u[0]===c?(t.length>0&&r.emit([...t]),t.length=0,r.down([[c]])):u[0]===p&&r.down([u])}),a=e.subscribe(i=>{for(let u of i)u[0]===m?t.length>0&&(r.emit([...t]),t.length=0):u[0]===c?r.down([[c]]):u[0]===p&&r.down([u])});return()=>{s(),a(),t.length=0}},h(n))}function sn(o,e,n){if(e<=0)throw new RangeError("bufferCount expects count > 0");return b(r=>{let t=[],s=o.subscribe(a=>{for(let i of a)i[0]===m?(t.push(i[1]),t.length>=e&&r.emit(t.splice(0,t.length))):i[0]===c?(t.length>0&&r.emit([...t]),t.length=0,r.down([[c]])):i[0]===p&&r.down([i])});return()=>{s(),t.length=0}},h(n))}function an(o,e,n){if(e<=0)throw new RangeError("windowCount expects count > 0");return b(r=>{let t,s=0;function a(){let u=b(d=>(t=d.down.bind(d),()=>{t=void 0}),h());s=0,r.emit(u)}let i=o.subscribe(u=>{for(let d of u)d[0]===m?(t||a(),t?.([[m,d[1]]]),s+=1,s>=e&&(t?.([[c]]),t=void 0)):d[0]===c?(t?.([[c]]),t=void 0,r.down([[c]])):d[0]===p&&(t?.([d]),t=void 0,r.down([d]))});return()=>{i(),t?.([[c]]),t=void 0}},h(n))}function un(o,e,n){return b(r=>{let t=[],s=setInterval(()=>{t.length>0&&(r.emit([...t]),t.length=0)},e),a=o.subscribe(i=>{for(let u of i)u[0]===m?t.push(u[1]):u[0]===c?(clearInterval(s),t.length>0&&r.emit([...t]),t.length=0,r.down([[c]])):u[0]===p&&(clearInterval(s),r.down([u]))});return()=>{a(),clearInterval(s),t.length=0}},{...h(n),meta:{...E("bufferTime",{ms:e}),...n?.meta??{}}})}function dn(o,e,n){return b(r=>{let t;function s(){t?.([[c]]),t=void 0}function a(){let d=b(l=>(t=l.down.bind(l),()=>{t=void 0}),h());r.emit(d)}a();let i=setInterval(()=>{s(),a()},e),u=o.subscribe(d=>{for(let l of d)l[0]===m?t?.([[m,l[1]]]):l[0]===c?(clearInterval(i),s(),r.down([[c]])):l[0]===p&&(clearInterval(i),t?.([l]),s(),r.down([l]))});return()=>{u(),clearInterval(i),s()}},h(n))}function ln(o,e,n){return b(r=>{let t;function s(){t?.([[c]]),t=void 0}function a(){let d=b(l=>(t=l.down.bind(l),()=>{t=void 0}),h());r.emit(d)}let i=o.subscribe(d=>{for(let l of d)l[0]===m?(t||a(),t?.([[m,l[1]]])):l[0]===c?(s(),r.down([[c]])):l[0]===p&&(t?.([l]),t=void 0,r.down([l]))}),u=e.subscribe(d=>{for(let l of d)l[0]===m&&(s(),a())});return()=>{i(),u(),s()}},h(n))}function cn(o,e){return b((n,r)=>{"n"in r.store||(r.store.n=0);let t=setInterval(()=>{n.emit(r.store.n),r.store.n=r.store.n+1},o);return()=>clearInterval(t)},h(e))}function fn(o,e,n){if(e<=0)throw new RangeError("repeat expects count > 0");return b(r=>{let t=e,s,a=()=>{s?.(),s=o.subscribe(i=>{let u=!1,d=[];for(let l of i)l[0]===c?u=!0:d.push(l);d.length>0&&r.down(d),u&&(s?.(),s=void 0,t-=1,t>0?a():r.down([[c]]))})};return a(),()=>{s?.()}},h(n))}function pn(o,e){return y([o],(n,r)=>{let t=n[0];if(t==null||t.length===0){r.down([[g]]);return}for(let s of t)r.emit(s)},h(e))}function rt(o,e,n){return b(r=>{let t=o.subscribe(s=>{for(let a of s)if(a[0]===m)r.emit(a[1]);else if(a[0]===p)try{r.emit(e(a[1]))}catch(i){r.down([[p,i]])}else a[0]===c&&r.down([[c]])});return()=>{t()}},h(n))}function hn(o,e,n){return y([o,e],(r,t,s)=>{let a=r[1];if(!(a!=null&&a.length>0?a.at(-1):s.prevData[1])){t.down([[g]]);return}let u=r[0];if(u!=null&&u.length>0){for(let d of u)t.emit(d);return}if(a!=null&&a.length>0&&s.prevData[0]!==void 0){t.emit(s.prevData[0]);return}t.down([[g]])},Ye(n))}var Wt,Qt,mn,gn,bn,Tn,ot=R(()=>{"use strict";ie();B();je();Te();_e();qe();Wt=Ze;Qt=et;mn=Qe,gn=tt,bn=nt,Tn=rt});var _n={};lt(_n,{audit:()=>nn,buffer:()=>on,bufferCount:()=>sn,bufferTime:()=>un,catchError:()=>Tn,combine:()=>Qe,combineLatest:()=>mn,concat:()=>qt,concatMap:()=>Zt,debounce:()=>tt,debounceTime:()=>gn,delay:()=>en,distinctUntilChanged:()=>Bt,elementAt:()=>Ut,exhaustMap:()=>Xt,filter:()=>Je,find:()=>Vt,first:()=>Gt,flatMap:()=>Qt,interval:()=>cn,last:()=>Pt,map:()=>St,merge:()=>$t,mergeMap:()=>et,onFirstData:()=>Ze,pairwise:()=>jt,pausable:()=>pn,race:()=>Yt,reduce:()=>It,repeat:()=>fn,rescue:()=>rt,sample:()=>tn,scan:()=>Ct,skip:()=>Xe,switchMap:()=>Jt,take:()=>ee,takeUntil:()=>Lt,takeWhile:()=>Ft,tap:()=>Ht,tapFirst:()=>Wt,throttle:()=>nt,throttleTime:()=>bn,timeout:()=>rn,valve:()=>hn,window:()=>ln,windowCount:()=>an,windowTime:()=>dn,withLatestFrom:()=>zt,zip:()=>Kt});module.exports=ft(_n);var yn=R(()=>{ot()});yn();0&&(module.exports={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});
|
|
1
|
+
"use strict";var se=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var ut=Object.getOwnPropertyNames;var dt=Object.prototype.hasOwnProperty;var R=(o,e)=>()=>(o&&(e=o(o=0)),e);var lt=(o,e)=>{for(var n in e)se(o,n,{get:e[n],enumerable:!0})},ct=(o,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of ut(e))!dt.call(o,t)&&t!==n&&se(o,t,{get:()=>e[t],enumerable:!(r=at(e,t))||r.enumerable});return o};var ft=o=>ct(se({},"__esModule",{value:!0}),o);function q(){return Math.trunc(performance.now()*1e6)}function ve(){return Date.now()*1e6}var ie=R(()=>{"use strict"});var C,m,D,g,F,L,W,I,c,p,V,ae,pt,ue,ht,mt,de,we,Ne,xe,le,B=R(()=>{"use strict";C=Symbol.for("graphrefly/START"),m=Symbol.for("graphrefly/DATA"),D=Symbol.for("graphrefly/DIRTY"),g=Symbol.for("graphrefly/RESOLVED"),F=Symbol.for("graphrefly/INVALIDATE"),L=Symbol.for("graphrefly/PAUSE"),W=Symbol.for("graphrefly/RESUME"),I=Symbol.for("graphrefly/TEARDOWN"),c=Symbol.for("graphrefly/COMPLETE"),p=Symbol.for("graphrefly/ERROR"),V=Object.freeze([D]),ae=Object.freeze([g]),pt=Object.freeze([F]),ue=Object.freeze([C]),ht=Object.freeze([c]),mt=Object.freeze([I]),de=Object.freeze([V]),we=Object.freeze([ae]),Ne=Object.freeze([pt]),xe=Object.freeze([ht]),le=Object.freeze([mt])});var G,ke=R(()=>{"use strict";G=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 Ee(o){o.registerCodec(gt)}var gt,Oe=R(()=>{"use strict";gt={name:"json",version:1,contentType:"application/json",encode(o){let e=JSON.stringify(o);return new TextEncoder().encode(e)},decode(o,e){let n=new TextDecoder().decode(o);return JSON.parse(n)}}});function Y(o){if(o==null)return bt;let{type:e,id:n,...r}=o;return{type:e??"system",id:n??"",...r}}var bt,Ae=R(()=>{"use strict";bt={type:"system",id:""}});function Se(){return ce>0||Tt}function Ce(){return ce>0}function Ie(o){ce>0?yt.push(o):o()}function J(o,e,n){if(e.length===0)return;if(e.length===1){let d=n(e[0][0]);if(d<3||!Se()){o(e);return}(d>=5?Me:d===4?De:Re).push(()=>o(e));return}let r=e.length,t=r,s=r,a=r,i=0;for(;i<r&&n(e[i][0])<3;)i++;for(t=i;i<r&&n(e[i][0])===3;)i++;for(s=i;i<r&&n(e[i][0])===4;)i++;a=i;let u=Se();if(t>0){let d=e.slice(0,t);o(d)}if(s>t){let d=e.slice(t,s);u?Re.push(()=>o(d)):o(d)}if(a>s){let d=e.slice(s,a);u?De.push(()=>o(d)):o(d)}if(r>a){let d=e.slice(a,r);u?Me.push(()=>o(d)):o(d)}}var ce,Tt,Re,De,Me,yt,Fe=R(()=>{"use strict";ce=0,Tt=!1,Re=[],De=[],Me=[],yt=[]});function Le(o){o.registerMessageType(C,{tier:0,wireCrossing:!1}),o.registerMessageType(D,{tier:1,wireCrossing:!1}),o.registerMessageType(F,{tier:1,wireCrossing:!1,metaPassthrough:!1}),o.registerMessageType(L,{tier:2,wireCrossing:!1}),o.registerMessageType(W,{tier:2,wireCrossing:!1}),o.registerMessageType(m,{tier:3,wireCrossing:!0}),o.registerMessageType(g,{tier:3,wireCrossing:!0}),o.registerMessageType(c,{tier:4,wireCrossing:!0,metaPassthrough:!1}),o.registerMessageType(p,{tier:4,wireCrossing:!0,metaPassthrough:!1}),o.registerMessageType(I,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var X,Ve=R(()=>{"use strict";B();X=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_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}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=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 fe(o){if(o===void 0)return null;if(typeof o=="number"){if(!Number.isFinite(o))throw new TypeError(`Cannot hash non-finite number: ${o}`);if(Number.isInteger(o)&&!Number.isSafeInteger(o))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${o}. Cross-language cid parity is not guaranteed for unsafe integers.`);return o}if(typeof o=="string"||typeof o=="boolean"||o===null)return o;if(Array.isArray(o))return o.map(fe);if(typeof o=="object"&&o!==null){let e={};for(let n of Object.keys(o).sort())e[n]=fe(o[n]);return e}return null}function wt(o){let e=vt.encode(o),n=e.length,r=n*8,t=n+9+63&-64,s=new Uint8Array(t);s.set(e),s[n]=128;let a=new DataView(s.buffer);a.setUint32(t-4,r>>>0,!1),a.setUint32(t-8,Math.floor(r/4294967296)>>>0,!1);let i=1779033703,u=3144134277,d=1013904242,l=2773480762,f=1359893119,y=2600822924,T=528734635,w=1541459225,O=new Uint32Array(64),v=(A,x)=>A>>>x|A<<32-x;for(let A=0;A<t;A+=64){for(let k=0;k<16;k++)O[k]=a.getUint32(A+k*4,!1);for(let k=16;k<64;k++){let U=O[k-15],H=O[k-2],K=v(U,7)^v(U,18)^U>>>3,oe=v(H,17)^v(H,19)^H>>>10;O[k]=O[k-16]+K+O[k-7]+oe>>>0}let x=i,M=u,P=d,ne=l,S=f,z=y,$=T,re=w;for(let k=0;k<64;k++){let U=v(S,6)^v(S,11)^v(S,25),H=S&z^~S&$,K=re+U+H+_t[k]+O[k]>>>0,oe=v(x,2)^v(x,13)^v(x,22),st=x&M^x&P^M&P,it=oe+st>>>0;re=$,$=z,z=S,S=ne+K>>>0,ne=P,P=M,M=x,x=K+it>>>0}i=i+x>>>0,u=u+M>>>0,d=d+P>>>0,l=l+ne>>>0,f=f+S>>>0,y=y+z>>>0,T=T+$>>>0,w=w+re>>>0}let N=A=>A.toString(16).padStart(8,"0");return N(i)+N(u)+N(d)+N(l)+N(f)+N(y)+N(T)+N(w)}function pe(o){let e=fe(o??null),n=JSON.stringify(e);return wt(n).slice(0,16)}function Nt(){let o=globalThis.crypto;if(o?.randomUUID)return o.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 he(o,e,n){let r=n?.id??Nt();if(o===0)return{id:r,version:0};let s=(n?.hash??pe)(e);return{id:r,version:0,cid:s,prev:null}}function Ge(o,e,n){o.version+=1,"cid"in o&&(o.prev=o.cid,o.cid=n(e))}var _t,vt,Pe=R(()=>{"use strict";_t=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]),vt=new TextEncoder});function We(o){return{node:o,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function me(o){o.prevData=void 0,o.dirty=!1,o.involvedThisWave=!1,o.dataBatch.length=0,o.terminal=void 0}function Z(o){return o.length===0?o:typeof o[0]=="symbol"?[o]:o}function _(o,e,n){let r=Be(o)?o:[],t=typeof o=="function"?o:typeof e=="function"?e:void 0,s={};return Be(o)?s=(ge(e)?e:n)??{}:ge(o)?s=o:s=(ge(e)?e:n)??{},new Q(r,t,s)}var Ue,He,xt,kt,be,Q,Be,ge,Te=R(()=>{"use strict";Oe();Ae();Fe();ie();Ve();ke();B();Pe();Ue=()=>{},He=100;xt=(o,e,n,r)=>{n.direction==="down-in"&&o._onDepMessage(n.depIndex,e)},kt=(o,e,n,r)=>{let t=o;if(t._status==="completed"||t._status==="errored")return;let s=t._cached,a=s===void 0?[ue]:[ue,[m,s]];t._status==="dirty"&&a.push(V),J(e,a,t._config.tierOf)},be=new X({onMessage:xt,onSubscribe:kt});Le(be);Ee(be);Q=class o{_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??be,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??pe;let t=r.versioning??this._config.defaultVersioning;this._versioningLevel=t,this._versioning=t!=null?he(t,this._cached===void 0?void 0:this._cached,{id:r.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(We);let s={};for(let[i,u]of Object.entries(r.meta??{})){let d={initial:u,name:`${r.name??"node"}:meta:${i}`,describeKind:"state",config:this._config};r.guard!=null&&(d.guard=r.guard),r.resubscribable===!0&&(d.resubscribable=!0),s[i]=new o([],void 0,d)}Object.freeze(s),this.meta=s,this._hasMeta=Object.keys(s).length>0;let a=this;this._actions={emit(i){a._emit([[m,i]])},down(i){a._emit(Z(i))},up(i){a._emitUp(Z(i))}},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 t=n?.hash??this._hashFn;t!==this._hashFn&&(this._hashFn=t);let s=this._cached===void 0?void 0:this._cached,a=this._versioning,i=a?.id??n?.id,u=a?.version??0,d=he(e,s,{id:i,hash:t});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=Y(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 t=Y(e?.actor),s=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(t,s))throw new G({actor:t,action:s,nodeName:this.name});if(this._extraGuards!=null){for(let a of this._extraGuards)if(!a(t,s))throw new G({actor:t,action:s,nodeName:this.name})}this._lastMutation={actor:t,timestamp_ns:ve()}}down(e,n){let r=Z(e);r.length!==0&&(this._checkGuard(n),this._emit(r))}emit(e,n){this._checkGuard(n),this._emit([[m,e]])}up(e,n){if(this._deps.length===0)return;let r=Z(e);if(r.length===0)return;this._checkGuard(n);let t=n??{internal:!0};this._validateUpTiers(r);for(let s of this._deps)s.node.up?.(r,t)}_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 t=n(r[0]);if(t===3||t===4)throw new Error(`Node "${this.name}": tier-${t} 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=Y(n);if(!this._guard(u,"observe"))throw new G({actor:u,action:"observe",nodeName:this.name})}let t=this._isTerminal&&this._resubscribable;if(t){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 s;try{s=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:t},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 a=this._isTerminal;if(this._sinkCount===1&&!a)try{this._activate()}catch(u){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof s=="function")try{s()}catch{}throw u}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let i=!1;return()=>{i||(i=!0,this._sinkCount-=1,this._removeSink(e),typeof s=="function"&&s(),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 t=r,s=this._deps[r];s.unsub=Ue,s.unsub=s.node.subscribe(a=>{if(s.unsub===null)return;let i=this._config.tierOf,u=!1;for(let d of a)i(d[0])>=3&&(u=!0),this._config.onMessage(this,d,{direction:"down-in",depIndex:t},this._actions);u&&this._maybeRunFnOnSettlement()}),n++}}catch(r){this._deps[n].unsub=null;for(let t=0;t<n;t++){let s=this._deps[t];if(s.unsub!=null){let a=s.unsub;s.unsub=null;try{a()}catch{}me(s)}}throw this._dirtyDepCount=0,r}}_addDep(e){for(let t=0;t<this._deps.length;t++)if(this._deps[t].node===e)return t;let n=this._deps.length,r=We(e);if(this._deps.push(r),this._sinks==null)return n;r.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(de),r.unsub=Ue;try{r.unsub=e.subscribe(t=>{if(r.unsub===null)return;let s=this._config.tierOf,a=!1;for(let i of t)s(i[0])>=3&&(a=!0),this._config.onMessage(this,i,{direction:"down-in",depIndex:n},this._actions);a&&this._maybeRunFnOnSettlement()})}catch(t){throw r.unsub=null,this._deps.pop(),this._dirtyDepCount--,t}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(t){this._emit([[p,this._wrapFnError("cleanup.deactivate threw",t)]])}}for(let r of this._deps){if(r.unsub!=null){let t=r.unsub;r.unsub=null;try{t()}catch{}}me(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],t=n[0];if(this._inspectorHooks!=null){let s={kind:"dep_message",depIndex:e,message:n};for(let a of this._inspectorHooks)a(s)}if(t!==C){if(t===D){this._depDirtied(r);return}if(t===F){if(this._depInvalidated(r),this._cached===void 0)return;this._emit(Ne);return}if(t===L||t===W){this._emit([n]);return}if(t===I){this._emit(le);return}if(t===m)this._depSettledAsData(r,n[1]);else if(t===g)this._depSettledAsResolved(r);else if(t===c)this._depSettledAsTerminal(r,!0);else if(t===p)this._depSettledAsTerminal(r,n[1]);else{this._emit([n]);return}if(!this._fn){(t===m||t===g)&&this._emit([n]),(t===c||t===p)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(de))}_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(we),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(xe)}_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(a){this._emit([[p,this._wrapFnError("cleanup threw",a)]]);return}}else if(e!=null&&typeof e=="object"){let a=e.beforeRun;if(typeof a=="function"){e.beforeRun=void 0;try{a()}catch(i){this._emit([[p,this._wrapFnError("cleanup.beforeRun threw",i)]]);return}}}let n=this._deps.map(a=>a.involvedThisWave?a.dataBatch.length>0?[...a.dataBatch]:[]:void 0),r=this._deps.map(a=>a.prevData);for(let a=0;a<this._deps.length;a++){let i=n[a];i!=null&&i.length>0&&(this._deps[a].prevData=i[i.length-1])}let t=this._deps.map(a=>a.terminal),s={prevData:r,terminalDeps:t,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let a={kind:"run",batchData:n,prevData:r};for(let i of this._inspectorHooks)i(a)}this._isExecutingFn=!0;try{let a=this._fn(n,this._actions,s);if(typeof a=="function")this._cleanup=a;else if(a!=null&&typeof a=="object"){let i=a;(typeof i.beforeRun=="function"||typeof i.deactivate=="function"||typeof i.invalidate=="function")&&(this._cleanup=a)}}catch(a){this._emit([[p,this._wrapFnError("fn threw",a)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>He?(this._rerunDepth=0,this._emit([[p,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${He} \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"?[V,e[0]]:e;let r=!0,t=!1,s=!1,a=-1;for(let u of e){let d=n(u[0]);d<a&&(r=!1),d===3&&(t=!0),u[0]===D&&(s=!0),a=d}let i=e;if(!r){let u=e.map((d,l)=>({m:d,i:l,tier:n(d[0])}));u.sort((d,l)=>d.tier-l.tier||d.i-l.i),i=u.map(d=>d.m)}if(t&&!s&&this._status!=="dirty"){let u=0;for(;u<i.length&&n(i[u][0])===0;)u++;return u===0?[V,...i]:[...i.slice(0,u),V,...i.slice(u)]}return i}_emit(e){if(e.length===0)return;for(let i=0;i<e.length;i++){let u=e[i];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 i=e.filter(u=>u[0]===I||u[0]===F);if(i.length===0)return;n=i}n=this._frameBatch(n);let t=null;for(let i=0;i<n.length;i++){let u=n[i],d=u[0];if(d!==L&&d!==W){t?.push(u);continue}if(u.length<2)throw new Error(`Node "${this.name}": [[${d===L?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let l=!0;if(this._pausable!==!1){let f=u[1];if(d===L)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(f),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(f))l=!1;else if(this._pauseLocks.delete(f),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let y=this._pauseBuffer;this._pauseBuffer=[],this._emit(y)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}l?t?.push(u):t==null&&(t=n.slice(0,i))}if(t!=null){if(t.length===0)return;n=t}if(this._hasMeta&&n.some(i=>i[0]===I))for(let i of Object.keys(this.meta))try{this.meta[i]._emit(le)}catch{}let{finalMessages:s,equalsError:a}=this._updateState(n);if(s.length>0&&this._config.inspectorEnabled){let i=this._config.globalInspector;if(i!=null)try{i({kind:"emit",node:this,messages:s})}catch{}}if(s.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let i=this._config.tierOf,u=[];for(let d of s)i(d[0])===3?this._pauseBuffer.push(d):u.push(d);u.length>0&&this._dispatchOrAccumulate(u)}else this._dispatchOrAccumulate(s);a!=null&&this._emit([[p,a]])}_updateState(e){let n=this._config.tierOf,r,t,s=-1,a=0;for(let l of e)n(l[0])===3&&a++;let i=a<=1,u=-1;if(this._versioning!=null&&a>1){for(let l=e.length-1;l>=0;l--)if(e[l][0]===m){u=l;break}}for(let l=0;l<e.length;l++){let f=e[l],y=f[0];if(y===m){if(f.length>=2){let T=!1;if(i&&this._cached!==void 0)try{T=this._equals(this._cached,f[1])}catch(w){t=this._wrapFnError("equals threw",w),s=l;break}if(T){r==null&&(r=e.slice(0,l)),r.push(ae),this._status="resolved";continue}this._cached=f[1],this._versioning!=null&&(u<0||l===u)&&Ge(this._versioning,f[1],this._hashFn)}this._status="settled",r?.push(f)}else if(r?.push(f),y===D)this._status="dirty";else if(y===g)this._status="resolved";else if(y===c){this._status="completed";{let T=this._config.rigorRecorder;if(T!=null)try{T.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(y===p){this._status="errored";{let T=this._config.rigorRecorder;if(T!=null)try{T.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(y===F){if(this._cached!==void 0){let w=this._config.rigorRecorder;if(w!=null)try{w.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let T=this._cleanup;if(typeof T=="function"){this._cleanup=void 0;try{T()}catch{}}else if(T!=null&&typeof T=="object"){let w=T.invalidate;if(typeof w=="function")try{w()}catch{}}}else y===I&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let d=s>=0?r??e.slice(0,s):r??e;return t!=null?{finalMessages:d,equalsError:t}:{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(Ce()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Ie(()=>this._flushBatchPending()));for(let n of e)this._batchPendingMessages.push(n);return}J(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);J(this._deliverToSinks,n,this._config.tierOf)}},Be=o=>Array.isArray(o),ge=o=>typeof o=="object"&&o!=null&&!Array.isArray(o)});function E(o,e){let n={factory:o};return e!==void 0&&(n.factoryArgs=e),n}var je=R(()=>{"use strict"});function b(o,e){return _((r,t,s)=>o(t,s)??void 0,{describeKind:"producer",...e})}function ze(o,e,n){return _(o,(t,s,a)=>{let i=t.map((u,d)=>u!=null&&u.length>0?u.at(-1):a.prevData[d]);s.emit(e(i,a))},{describeKind:"derived",...n})}var ye=R(()=>{"use strict";Te()});function _e(o){return{describeKind:"producer",...o}}function $e(o,e){return b(n=>{let r=!1;try{for(let t of o){if(r)return;n.emit(t)}r||n.down([[c]])}catch(t){r||n.down([[p,t]])}return()=>{r=!0}},_e(e))}function Et(o){return o!=null&&typeof o.then=="function"}function Ot(o,e){let{signal:n,...r}=e??{};return b(t=>{let s=!1,a=()=>{s||(s=!0,t.down([[p,n.reason]]))};if(n?.aborted){a();return}return n?.addEventListener("abort",a,{once:!0}),Promise.resolve(o).then(i=>{s||(s=!0,n?.removeEventListener("abort",a),t.emit(i),t.down([[c]]))},i=>{s||(s=!0,n?.removeEventListener("abort",a),t.down([[p,i]]))}),()=>{s=!0,n?.removeEventListener("abort",a)}},_e(r))}function At(o,e){let{signal:n,...r}=e??{};return b(t=>{let s=new AbortController,a=()=>s.abort(n?.reason);n?.aborted?s.abort(n.reason):n?.addEventListener("abort",a,{once:!0});let i=n??s.signal,u=!1,d=o[Symbol.asyncIterator](),l=()=>{u||i.aborted||Promise.resolve(d.next()).then(f=>{if(!(u||i.aborted)){if(f.done){t.down([[c]]);return}t.emit(f.value),l()}},f=>{!u&&!i.aborted&&t.down([[p,f]])})};return l(),()=>{u=!0,n?.removeEventListener("abort",a),s.abort(),Promise.resolve(d.return?.()).catch(()=>{})}},_e(r))}function Rt(o){return o!=null&&typeof o=="object"&&"cache"in o&&typeof o.subscribe=="function"}function j(o,e){if(Rt(o))return o;if(Et(o))return Ot(o,e);if(o!=null){let n=o;if(typeof n[Symbol.asyncIterator]=="function")return At(o,e);if(typeof n[Symbol.iterator]=="function")return $e(o,e)}return Dt(o)}function Dt(...o){return $e(o,void 0)}var Ke=R(()=>{"use strict";B();ye()});var qe=R(()=>{"use strict";Ke()});function h(o){return{describeKind:"derived",...o}}function Ye(o){return{describeKind:"derived",partial:!0,...o}}function St(o,e,n){return _([o],(r,t)=>{let s=r[0];if(s==null||s.length===0){t.down([[g]]);return}for(let a of s)t.emit(e(a))},{...h(n),meta:{...E("map"),...n?.meta??{}}})}function Je(o,e,n){return _([o],(r,t)=>{let s=r[0];if(s==null||s.length===0){t.down([[g]]);return}let a=!1;for(let i of s)e(i)&&(t.emit(i),a=!0);a||t.down([[g]])},{...h(n),meta:{...E("filter"),...n?.meta??{}}})}function Ct(o,e,n,r){return _([o],(t,s,a)=>{"acc"in a.store||(a.store.acc=n);let i=t[0];if(i==null||i.length===0){s.down([[g]]);return}for(let u of i)a.store.acc=e(a.store.acc,u),s.emit(a.store.acc)},{...h(r),initial:n,resetOnTeardown:!0,meta:{...E("scan",{initial:n}),...r?.meta??{}}})}function It(o,e,n,r){return _([o],(t,s,a)=>{if("acc"in a.store||(a.store.acc=n),a.terminalDeps[0]===!0){s.emit(a.store.acc),s.down([[c]]);return}let i=t[0];if(i==null||i.length===0){s.down([[g]]);return}for(let u of i)a.store.acc=e(a.store.acc,u)},{...h(r),completeWhenDepsComplete:!1,meta:{...E("reduce",{initial:n}),...r?.meta??{}}})}function ee(o,e,n){return e<=0?_([o],(r,t,s)=>{s.store.completed||(s.store.completed=!0,t.down([[c]]))},{...h(n),completeWhenDepsComplete:!1,meta:{...E("take",{count:e}),...n?.meta??{}}}):_([o],(r,t,s)=>{if("taken"in s.store||(s.store.taken=0),s.store.done){t.down([[g]]);return}if(s.terminalDeps[0]===!0){s.store.done=!0,t.down([[c]]);return}let a=r[0];if(a==null||a.length===0){t.down([[g]]);return}for(let i of a)if(s.store.taken++,t.emit(i),s.store.taken>=e){s.store.done=!0,t.down([[c]]);return}},{...h(n),completeWhenDepsComplete:!1,meta:{...E("take",{count:e}),...n?.meta??{}}})}function Xe(o,e,n){return _([o],(r,t,s)=>{"skipped"in s.store||(s.store.skipped=0);let a=r[0];if(a==null||a.length===0){t.down([[g]]);return}let i=!1;for(let u of a)s.store.skipped++,s.store.skipped<=e||(t.emit(u),i=!0);i||t.down([[g]])},h(n))}function Ft(o,e,n){return _([o],(r,t,s)=>{if(s.store.done){t.down([[g]]);return}let a=r[0];if(a==null||a.length===0){t.down([[g]]);return}for(let i of a){if(!e(i)){s.store.done=!0,t.down([[c]]);return}t.emit(i)}},{...h(n),completeWhenDepsComplete:!1})}function Lt(o,e,n){let r=n?.predicate??(a=>a[0]===m),{predicate:t,...s}=n??{};return b(a=>{let i=!1,u=o.subscribe(l=>{if(!i)for(let f of l){if(i)return;f[0]===m?a.emit(f[1]):(f[0]===c||f[0]===p)&&(i=!0,a.down([f]))}}),d=e.subscribe(l=>{if(!i)for(let f of l){if(i)return;if(r(f)){i=!0,a.down([[c]]);return}}});return()=>{u(),d()}},h(s))}function Vt(o,e){return ee(o,1,e)}function Gt(o,e){let{defaultValue:n,...r}=e??{},t=e!=null&&Object.hasOwn(e,"defaultValue");return _([o],(s,a,i)=>{if(i.terminalDeps[0]===!0){i.store.has?a.emit(i.store.latest):t&&a.emit(n),a.down([[c]]);return}let u=s[0];if(u==null||u.length===0){a.down([[g]]);return}i.store.latest=u.at(-1),i.store.has=!0},{...h(r),completeWhenDepsComplete:!1})}function Pt(o,e,n){return ee(Je(o,e,n),1,n)}function Ut(o,e,n){return ee(Xe(o,e,n),1,n)}function Ht(o,e,n){if(typeof e=="function")return _([o],(t,s)=>{let a=t[0];if(a==null||a.length===0){s.down([[g]]);return}for(let i of a)e(i),s.emit(i)},{...h(n),meta:{...E("tap"),...n?.meta??{}}});let r=e;return _([o],(t,s,a)=>{if(a.terminalDeps[0]!==void 0){a.terminalDeps[0]===!0?(r.complete?.(),s.down([[c]])):(r.error?.(a.terminalDeps[0]),s.down([[p,a.terminalDeps[0]]]));return}let i=t[0];if(i==null||i.length===0){s.down([[g]]);return}for(let u of i)r.data?.(u),s.emit(u)},{...h(n),completeWhenDepsComplete:!1,meta:{...E("tap"),...n?.meta??{}}})}function Ze(o,e,n){let r=n?.where??(s=>s!=null),t=!1;return _([o],(s,a)=>{let i=s[0];if(i==null||i.length===0){a.down([[g]]);return}for(let u of i)!t&&r(u)&&(t=!0,e(u)),a.emit(u)},h(n))}function Bt(o,e=Object.is,n){return _([o],(r,t,s)=>{let a=r[0];if(a==null||a.length===0){t.down([[g]]);return}let i=!1;for(let u of a)s.store.hasPrev&&e(s.store.prev,u)||(s.store.prev=u,s.store.hasPrev=!0,t.emit(u),i=!0);i||t.down([[g]])},{...h(n),meta:{...E("distinctUntilChanged"),...n?.meta??{}}})}function jt(o,e){return _([o],(n,r,t)=>{let s=n[0];if(s==null||s.length===0){r.down([[g]]);return}let a=!1;for(let i of s)if(!t.store.hasPrev)t.store.prev=i,t.store.hasPrev=!0;else{let u=[t.store.prev,i];t.store.prev=i,r.emit(u),a=!0}a||r.down([[g]])},h(e))}function Qe(...o){let e=[...o];return ze(e,n=>n,{...h(),equals:(n,r)=>{if(n.length!==r.length)return!1;for(let t=0;t<n.length;t++)if(!Object.is(n[t],r[t]))return!1;return!0}})}function zt(o,e,n){return _([o,e],(r,t,s)=>{let a=r[0],i=r[1],u=i!=null&&i.length>0?i.at(-1):s.prevData[1];if(a!=null&&a.length>0){if(!(i!=null&&i.length>0)&&s.prevData[1]===void 0){t.down([[g]]);return}for(let d of a)t.emit([d,u])}else t.down([[g]])},{...Ye(n),meta:{...E("withLatestFrom"),...n?.meta??{}}})}function $t(...o){return o.length===0?b(e=>{e.down([[c]])},{...h(),meta:{...E("merge")}}):b(e=>{let n=o.length,r=0,t=[];for(let s of o){let a=s.subscribe(i=>{for(let u of i)u[0]===m?e.emit(u[1]):u[0]===c?(r+=1,r>=n&&e.down([[c]])):u[0]===p&&e.down([u])});t.push(a)}return()=>{for(let s of t)s()}},{...h(),meta:{...E("merge")}})}function Kt(...o){let e=o.length;return e===0?b(n=>{n.emit([]),n.down([[c]])},h()):b(n=>{let r=Array.from({length:e},()=>[]),t=e;function s(){for(;r.every(i=>i.length>0);){let i=r.map(u=>u.shift());n.emit(i)}}let a=[];for(let i=0;i<e;i++){let u=i,d=o[i].subscribe(l=>{for(let f of l)f[0]===m?(r[u].push(f[1]),s()):f[0]===c?(t-=1,(t===0||r[u].length===0)&&n.down([[c]])):f[0]===p&&n.down([f])});a.push(d)}return()=>{for(let i of a)i()}},h())}function qt(o,e,n){return b(r=>{let t=0,s=[],a,i;return i=e.subscribe(u=>{for(let d of u)t===0?d[0]===m?s.push(d[1]):d[0]===p&&r.down([d]):d[0]===m?r.emit(d[1]):(d[0]===c||d[0]===p)&&r.down([d])}),a=o.subscribe(u=>{for(let d of u)if(t===0)if(d[0]===m)r.emit(d[1]);else if(d[0]===c){t=1;for(let l of s)r.emit(l);s.length=0}else d[0]===p&&r.down([d])}),()=>{a?.(),i?.()}},h(n))}function Yt(...o){return o.length===0?b(e=>{e.down([[c]])},h()):o.length===1?_([o[0]],(e,n)=>{let r=e[0];if(r==null||r.length===0){n.down([[g]]);return}for(let t of r)n.emit(t)},h()):b(e=>{let n=null,r=[];for(let t=0;t<o.length;t++){let s=t,a=o[t].subscribe(i=>{for(let u of i){if(n!==null&&s!==n)return;u[0]===m?(n===null&&(n=s),e.emit(u[1])):(u[0]===c||u[0]===p)&&(n===null||s===n)&&e.down([u])}});r.push(a)}return()=>{for(let t of r)t()}},h())}function te(o,e,n){let r,t=!1,s=()=>{t||(t=!0,n())};return r=o.subscribe(a=>{let i=!1,u=!1;for(let d of a)d[0]!==C&&(d[0]===m?e.emit(d[1]):d[0]===c?i=!0:d[0]===p?(u=!0,e.down([d])):(d[0]===D||d[0]===g)&&e.down([d]));u?(r?.(),r=void 0,s()):i&&s()}),()=>{r?.(),r=void 0}}function Jt(o,e,n){let r,t=!1;function s(){r?.(),r=void 0}return _([o],(a,i,u)=>{if(u.terminalDeps[0]!=null&&u.terminalDeps[0]!==!0){s();return}if(u.terminalDeps[0]===!0){t=!0,r||i.down([[c]]);return}let d=a[0];if(!(d==null||d.length===0))return s(),r=te(j(e(d[d.length-1])),i,()=>{s(),t&&i.down([[c]])}),{deactivate:()=>{s(),t=!1}}},{...h(n),completeWhenDepsComplete:!1,meta:{...E("switchMap"),...n?.meta??{}}})}function Xt(o,e,n){let r,t=!1;function s(){r?.(),r=void 0}return _([o],(a,i,u)=>{if(u.terminalDeps[0]!=null&&u.terminalDeps[0]!==!0){s();return}if(u.terminalDeps[0]===!0){t=!0,r||i.down([[c]]);return}let d=a[0];if(!(d==null||d.length===0))return r===void 0?r=te(j(e(d[0])),i,()=>{s(),t&&i.down([[c]])}):i.down([[g]]),{deactivate:()=>{s(),t=!1}}},{...h(n),completeWhenDepsComplete:!1})}function Zt(o,e,n){let{maxBuffer:r,...t}=n??{},s=[],a,i=!1,u;function d(){a?.(),a=void 0}function l(){if(!u||a!==void 0)return;if(s.length===0){i&&u.down([[c]]);return}let y=s.shift();a=te(j(e(y)),u,()=>{d(),l()})}function f(y){r&&r>0&&s.length>=r&&s.shift(),s.push(y),l()}return _([o],(y,T,w)=>{if(u=T,w.terminalDeps[0]!=null&&w.terminalDeps[0]!==!0){d(),s.length=0;return}if(w.terminalDeps[0]===!0){i=!0,l();return}let O=y[0];if(!(O==null||O.length===0)){for(let v of O)f(v);return{deactivate:()=>{d(),s.length=0,i=!1}}}},{...h(t),completeWhenDepsComplete:!1})}function et(o,e,n){let{concurrent:r,...t}=n??{},s=r!=null&&r>0?r:Number.POSITIVE_INFINITY,a=0,i=!1,u=new Set,d=[],l;function f(){i&&a===0&&d.length===0&&l&&l.down([[c]])}function y(v){if(!l)return;a++;let N;N=te(j(e(v)),l,()=>{N&&u.delete(N),a--,T(),f()}),u.add(N)}function T(){for(;d.length>0&&a<s;)y(d.shift())}function w(v){a<s?y(v):d.push(v)}function O(){for(let v of u)v();u.clear(),a=0,d.length=0}return _([o],(v,N,A)=>{if(l=N,A.terminalDeps[0]!=null&&A.terminalDeps[0]!==!0){O();return}if(A.terminalDeps[0]===!0){i=!0,f();return}let x=v[0];if(!(x==null||x.length===0)){for(let M of x)w(M);return{deactivate:()=>{O(),i=!1}}}},{...h(t),completeWhenDepsComplete:!1})}function en(o,e,n){return b(r=>{let t=new Set;function s(){for(let i of t)clearTimeout(i);t.clear()}let a=o.subscribe(i=>{for(let u of i)if(u[0]===m){let d=setTimeout(()=>{t.delete(d),r.emit(u[1])},e);t.add(d)}else if(u[0]===c){let d=setTimeout(()=>{t.delete(d),r.down([[c]])},e);t.add(d)}else u[0]===p&&(s(),r.down([u]))});return()=>{a(),s()}},h(n))}function tt(o,e,n){return b(r=>{let t,s;function a(){t!==void 0&&(clearTimeout(t),t=void 0)}let i=o.subscribe(u=>{for(let d of u)d[0]===m?(a(),s=d[1],t=setTimeout(()=>{t=void 0,r.emit(s)},e)):d[0]===c?(t!==void 0&&(a(),r.emit(s)),r.down([[c]])):d[0]===p&&(a(),r.down([d]))});return()=>{i(),a()}},{...h(n),meta:{...E("debounce",{ms:e}),...n?.meta??{}}})}function nt(o,e,n){let{leading:r,trailing:t,...s}=n??{},a=r!==!1,i=t===!0,u=e*1e6;return b(d=>{let l,f=-1/0,y,T=!1;function w(){l!==void 0&&(clearTimeout(l),l=void 0)}let O=o.subscribe(v=>{for(let N of v)if(N[0]===m){let A=N[1],x=q();if(a&&x-f>=u)f=x,d.emit(A),w(),i&&(l=setTimeout(()=>{l=void 0,T&&(f=q(),d.emit(y),T=!1)},e));else if(i&&(y=A,T=!0,l===void 0)){let M=(x-f)/1e6;l=setTimeout(()=>{l=void 0,T&&(f=q(),d.emit(y),T=!1)},Math.max(0,e-M))}}else(N[0]===c||N[0]===p)&&(w(),d.down([N]))});return()=>{O(),w()}},{...h(s),meta:{...E("throttle",{ms:e,leading:a,trailing:i}),...s.meta??{}}})}function tn(o,e,n){return b(r=>{let t,s=!1,a=!1,i=o.subscribe(d=>{if(!s)for(let l of d){if(s)return;l[0]===m?t={v:l[1]}:l[0]===p?(s=!0,r.down([l])):l[0]===c&&(a=!0,t=void 0)}}),u=e.subscribe(d=>{if(!s)for(let l of d){if(s)return;l[0]===m?t!==void 0&&!a&&r.emit(t.v):l[0]===p?(s=!0,r.down([l])):l[0]===c&&(s=!0,r.down([[c]]))}});return()=>{i(),u()}},h(n))}function nn(o,e,n){return b(r=>{let t,s,a=!1;function i(){t!==void 0&&(clearTimeout(t),t=void 0)}let u=o.subscribe(d=>{for(let l of d)l[0]===m?(s=l[1],a=!0,i(),t=setTimeout(()=>{t=void 0,a&&(a=!1,r.emit(s))},e)):(l[0]===c||l[0]===p)&&(i(),r.down([l]))});return()=>{u(),i()}},h(n))}function rn(o,e,n){let{with:r,...t}=n??{},s=r??new Error("timeout");return b(a=>{let i;function u(){clearTimeout(i),i=setTimeout(()=>{i=void 0,a.down([[p,s]])},e)}u();let d=o.subscribe(l=>{for(let f of l)f[0]===m?(u(),a.emit(f[1])):(f[0]===c||f[0]===p)&&(clearTimeout(i),a.down([f]))});return()=>{d(),clearTimeout(i)}},h(t))}function on(o,e,n){return b(r=>{let t=[],s=o.subscribe(i=>{for(let u of i)u[0]===m?t.push(u[1]):u[0]===c?(t.length>0&&r.emit([...t]),t.length=0,r.down([[c]])):u[0]===p&&r.down([u])}),a=e.subscribe(i=>{for(let u of i)u[0]===m?t.length>0&&(r.emit([...t]),t.length=0):u[0]===c?r.down([[c]]):u[0]===p&&r.down([u])});return()=>{s(),a(),t.length=0}},h(n))}function sn(o,e,n){if(e<=0)throw new RangeError("bufferCount expects count > 0");return b(r=>{let t=[],s=o.subscribe(a=>{for(let i of a)i[0]===m?(t.push(i[1]),t.length>=e&&r.emit(t.splice(0,t.length))):i[0]===c?(t.length>0&&r.emit([...t]),t.length=0,r.down([[c]])):i[0]===p&&r.down([i])});return()=>{s(),t.length=0}},h(n))}function an(o,e,n){if(e<=0)throw new RangeError("windowCount expects count > 0");return b(r=>{let t,s=0;function a(){let u=b(d=>(t=d.down.bind(d),()=>{t=void 0}),h());s=0,r.emit(u)}let i=o.subscribe(u=>{for(let d of u)d[0]===m?(t||a(),t?.([[m,d[1]]]),s+=1,s>=e&&(t?.([[c]]),t=void 0)):d[0]===c?(t?.([[c]]),t=void 0,r.down([[c]])):d[0]===p&&(t?.([d]),t=void 0,r.down([d]))});return()=>{i(),t?.([[c]]),t=void 0}},h(n))}function un(o,e,n){return b(r=>{let t=[],s=setInterval(()=>{t.length>0&&(r.emit([...t]),t.length=0)},e),a=o.subscribe(i=>{for(let u of i)u[0]===m?t.push(u[1]):u[0]===c?(clearInterval(s),t.length>0&&r.emit([...t]),t.length=0,r.down([[c]])):u[0]===p&&(clearInterval(s),r.down([u]))});return()=>{a(),clearInterval(s),t.length=0}},{...h(n),meta:{...E("bufferTime",{ms:e}),...n?.meta??{}}})}function dn(o,e,n){return b(r=>{let t;function s(){t?.([[c]]),t=void 0}function a(){let d=b(l=>(t=l.down.bind(l),()=>{t=void 0}),h());r.emit(d)}a();let i=setInterval(()=>{s(),a()},e),u=o.subscribe(d=>{for(let l of d)l[0]===m?t?.([[m,l[1]]]):l[0]===c?(clearInterval(i),s(),r.down([[c]])):l[0]===p&&(clearInterval(i),t?.([l]),s(),r.down([l]))});return()=>{u(),clearInterval(i),s()}},h(n))}function ln(o,e,n){return b(r=>{let t;function s(){t?.([[c]]),t=void 0}function a(){let d=b(l=>(t=l.down.bind(l),()=>{t=void 0}),h());r.emit(d)}let i=o.subscribe(d=>{for(let l of d)l[0]===m?(t||a(),t?.([[m,l[1]]])):l[0]===c?(s(),r.down([[c]])):l[0]===p&&(t?.([l]),t=void 0,r.down([l]))}),u=e.subscribe(d=>{for(let l of d)l[0]===m&&(s(),a())});return()=>{i(),u(),s()}},h(n))}function cn(o,e){return b((n,r)=>{"n"in r.store||(r.store.n=0);let t=setInterval(()=>{n.emit(r.store.n),r.store.n=r.store.n+1},o);return()=>clearInterval(t)},h(e))}function fn(o,e,n){if(e<=0)throw new RangeError("repeat expects count > 0");return b(r=>{let t=e,s,a=()=>{s?.(),s=o.subscribe(i=>{let u=!1,d=[];for(let l of i)l[0]===c?u=!0:d.push(l);d.length>0&&r.down(d),u&&(s?.(),s=void 0,t-=1,t>0?a():r.down([[c]]))})};return a(),()=>{s?.()}},h(n))}function pn(o,e){return _([o],(n,r)=>{let t=n[0];if(t==null||t.length===0){r.down([[g]]);return}for(let s of t)r.emit(s)},h(e))}function rt(o,e,n){return b(r=>{let t=o.subscribe(s=>{for(let a of s)if(a[0]===m)r.emit(a[1]);else if(a[0]===p)try{r.emit(e(a[1]))}catch(i){r.down([[p,i]])}else a[0]===c&&r.down([[c]])});return()=>{t()}},h(n))}function hn(o,e,n){return _([o,e],(r,t,s)=>{let a=r[1];if(!(a!=null&&a.length>0?a.at(-1):s.prevData[1])){t.down([[g]]);return}let u=r[0];if(u!=null&&u.length>0){for(let d of u)t.emit(d);return}if(a!=null&&a.length>0&&s.prevData[0]!==void 0){t.emit(s.prevData[0]);return}t.down([[g]])},Ye(n))}var Wt,Qt,mn,gn,bn,Tn,ot=R(()=>{"use strict";ie();B();je();Te();ye();qe();Wt=Ze;Qt=et;mn=Qe,gn=tt,bn=nt,Tn=rt});var yn={};lt(yn,{audit:()=>nn,buffer:()=>on,bufferCount:()=>sn,bufferTime:()=>un,catchError:()=>Tn,combine:()=>Qe,combineLatest:()=>mn,concat:()=>qt,concatMap:()=>Zt,debounce:()=>tt,debounceTime:()=>gn,delay:()=>en,distinctUntilChanged:()=>Bt,elementAt:()=>Ut,exhaustMap:()=>Xt,filter:()=>Je,find:()=>Pt,first:()=>Vt,flatMap:()=>Qt,interval:()=>cn,last:()=>Gt,map:()=>St,merge:()=>$t,mergeMap:()=>et,onFirstData:()=>Ze,pairwise:()=>jt,pausable:()=>pn,race:()=>Yt,reduce:()=>It,repeat:()=>fn,rescue:()=>rt,sample:()=>tn,scan:()=>Ct,skip:()=>Xe,switchMap:()=>Jt,take:()=>ee,takeUntil:()=>Lt,takeWhile:()=>Ft,tap:()=>Ht,tapFirst:()=>Wt,throttle:()=>nt,throttleTime:()=>bn,timeout:()=>rn,valve:()=>hn,window:()=>ln,windowCount:()=>an,windowTime:()=>dn,withLatestFrom:()=>zt,zip:()=>Kt});module.exports=ft(yn);var _n=R(()=>{ot()});_n();0&&(module.exports={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});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as NodeOptions, N as Node,
|
|
1
|
+
import { a as NodeOptions, N as Node, r as Message } from '../node-kK3CvTrR.cjs';
|
|
2
2
|
import { NodeInput } from './sources.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -33,6 +33,14 @@ declare function map<T, R>(source: Node<T>, project: (value: T) => R, opts?: Ext
|
|
|
33
33
|
/**
|
|
34
34
|
* Forwards values that satisfy `predicate`; otherwise emits `RESOLVED` with no `DATA` (two-phase semantics).
|
|
35
35
|
*
|
|
36
|
+
* **Wave-exclusivity contract** (COMPOSITION-GUIDE §41 / spec §1.3.3): the
|
|
37
|
+
* `RESOLVED` is emitted only when the entire wave produces zero passing
|
|
38
|
+
* values — never per-dropped-item, never trailing a wave that already
|
|
39
|
+
* emitted `DATA`. Mixed-batch inputs like `[v_pass, v_fail, v_pass2]`
|
|
40
|
+
* forward `[DATA, v_pass]` and `[DATA, v_pass2]` with no `RESOLVED` for
|
|
41
|
+
* the dropped middle entry. Consumers needing per-input drain accounting
|
|
42
|
+
* count upstream of `filter`, not on its output.
|
|
43
|
+
*
|
|
36
44
|
* @param source - Upstream node.
|
|
37
45
|
* @param predicate - Inclusion test.
|
|
38
46
|
* @param opts - Optional {@link NodeOptions} (excluding `describeKind`).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as NodeOptions, N as Node,
|
|
1
|
+
import { a as NodeOptions, N as Node, r as Message } from '../node-kK3CvTrR.js';
|
|
2
2
|
import { NodeInput } from './sources.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -33,6 +33,14 @@ declare function map<T, R>(source: Node<T>, project: (value: T) => R, opts?: Ext
|
|
|
33
33
|
/**
|
|
34
34
|
* Forwards values that satisfy `predicate`; otherwise emits `RESOLVED` with no `DATA` (two-phase semantics).
|
|
35
35
|
*
|
|
36
|
+
* **Wave-exclusivity contract** (COMPOSITION-GUIDE §41 / spec §1.3.3): the
|
|
37
|
+
* `RESOLVED` is emitted only when the entire wave produces zero passing
|
|
38
|
+
* values — never per-dropped-item, never trailing a wave that already
|
|
39
|
+
* emitted `DATA`. Mixed-batch inputs like `[v_pass, v_fail, v_pass2]`
|
|
40
|
+
* forward `[DATA, v_pass]` and `[DATA, v_pass2]` with no `RESOLVED` for
|
|
41
|
+
* the dropped middle entry. Consumers needing per-input drain accounting
|
|
42
|
+
* count upstream of `filter`, not on its output.
|
|
43
|
+
*
|
|
36
44
|
* @param source - Upstream node.
|
|
37
45
|
* @param predicate - Inclusion test.
|
|
38
46
|
* @param opts - Optional {@link NodeOptions} (excluding `describeKind`).
|
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,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-
|
|
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-CLVB32RD.js";import"../chunk-4VVTGLXJ.js";import"../chunk-GHBWHMRZ.js";import"../chunk-CRVT7D2P.js";import"../chunk-NTEURFZH.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 ge=Object.defineProperty;var tn=Object.getOwnPropertyDescriptor;var rn=Object.getOwnPropertyNames;var on=Object.prototype.hasOwnProperty;var O=(r,e)=>()=>(r&&(e=r(r=0)),e);var sn=(r,e)=>{for(var n in e)ge(r,n,{get:e[n],enumerable:!0})},an=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of rn(e))!on.call(r,i)&&i!==n&&ge(r,i,{get:()=>e[i],enumerable:!(t=tn(e,i))||t.enumerable});return r};var dn=r=>an(ge({},"__esModule",{value:!0}),r);function Oe(){return j>0||ee}function Ve(){return j>0}function Ce(r){j>0?ne.push(r):r()}function K(r){j+=1;let e=!1;try{r()}catch(n){throw e=!0,n}finally{if(j-=1,j===0)if(e){if(!ee){let n=ne.splice(0);for(let t of n)try{t()}catch{}P.length=0,G.length=0,q.length=0}}else un()}}function un(){let r=!ee;r&&(ee=!0);let e=[],n=0;try{for(;P.length>0||G.length>0||q.length>0||r&&ne.length>0;){if(r&&ne.length>0){let o=ne.splice(0);for(let a of o)try{a()}catch(s){e.push(s)}continue}if(n+=1,n>1e3)throw P.length=0,G.length=0,q.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let i=(P.length>0?P:G.length>0?G:q).splice(0);for(let o of i)try{o()}catch(a){e.push(a)}}}finally{r&&(ee=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function de(r,e,n){if(e.length===0)return;if(e.length===1){let u=n(e[0][0]);if(u<3||!Oe()){r(e);return}(u>=5?q:u===4?G:P).push(()=>r(e));return}let t=e.length,i=t,o=t,a=t,s=0;for(;s<t&&n(e[s][0])<3;)s++;for(i=s;s<t&&n(e[s][0])===3;)s++;for(o=s;s<t&&n(e[s][0])===4;)s++;a=s;let d=Oe();if(i>0){let u=e.slice(0,i);r(u)}if(o>i){let u=e.slice(i,o);d?P.push(()=>r(u)):r(u)}if(a>o){let u=e.slice(o,a);d?G.push(()=>r(u)):r(u)}if(t>a){let u=e.slice(a,t);d?q.push(()=>r(u)):r(u)}}var j,ee,P,G,q,ne,Y=O(()=>{"use strict";j=0,ee=!1,P=[],G=[],q=[],ne=[]});var te,k,R,I,H,B,re,z,D,N,J,ye,ln,_e,cn,fn,ve,Ie,De,Le,Te,U=O(()=>{"use strict";te=Symbol.for("graphrefly/START"),k=Symbol.for("graphrefly/DATA"),R=Symbol.for("graphrefly/DIRTY"),I=Symbol.for("graphrefly/RESOLVED"),H=Symbol.for("graphrefly/INVALIDATE"),B=Symbol.for("graphrefly/PAUSE"),re=Symbol.for("graphrefly/RESUME"),z=Symbol.for("graphrefly/TEARDOWN"),D=Symbol.for("graphrefly/COMPLETE"),N=Symbol.for("graphrefly/ERROR"),J=Object.freeze([R]),ye=Object.freeze([I]),ln=Object.freeze([H]),_e=Object.freeze([te]),cn=Object.freeze([D]),fn=Object.freeze([z]),ve=Object.freeze([J]),Ie=Object.freeze([ye]),De=Object.freeze([ln]),Le=Object.freeze([cn]),Te=Object.freeze([fn])});function Ke(r){r.registerCodec(hn)}var hn,ze=O(()=>{"use strict";hn={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 ue(r){if(r==null)return pn;let{type:e,id:n,...t}=r;return{type:e??"system",id:n??"",...t}}var pn,Fe=O(()=>{"use strict";pn={type:"system",id:""}});function ie(){return Math.trunc(performance.now()*1e6)}function Pe(){return Date.now()*1e6}var we=O(()=>{"use strict"});function Ge(r){r.registerMessageType(te,{tier:0,wireCrossing:!1}),r.registerMessageType(R,{tier:1,wireCrossing:!1}),r.registerMessageType(H,{tier:1,wireCrossing:!1,metaPassthrough:!1}),r.registerMessageType(B,{tier:2,wireCrossing:!1}),r.registerMessageType(re,{tier:2,wireCrossing:!1}),r.registerMessageType(k,{tier:3,wireCrossing:!0}),r.registerMessageType(I,{tier:3,wireCrossing:!0}),r.registerMessageType(D,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(N,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(z,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var le,He=O(()=>{"use strict";U();le=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_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}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=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 X,Be=O(()=>{"use strict";X=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 xe(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(xe);if(typeof r=="object"&&r!==null){let e={};for(let n of Object.keys(r).sort())e[n]=xe(r[n]);return e}return null}function gn(r){let e=bn.encode(r),n=e.length,t=n*8,i=n+9+63&-64,o=new Uint8Array(i);o.set(e),o[n]=128;let a=new DataView(o.buffer);a.setUint32(i-4,t>>>0,!1),a.setUint32(i-8,Math.floor(t/4294967296)>>>0,!1);let s=1779033703,d=3144134277,u=1013904242,c=2773480762,p=1359893119,h=2600822924,f=528734635,m=1541459225,y=new Uint32Array(64),w=(E,M)=>E>>>M|E<<32-M;for(let E=0;E<i;E+=64){for(let g=0;g<16;g++)y[g]=a.getUint32(E+g*4,!1);for(let g=16;g<64;g++){let x=y[g-15],A=y[g-2],S=w(x,7)^w(x,18)^x>>>3,Q=w(A,17)^w(A,19)^A>>>10;y[g]=y[g-16]+S+y[g-7]+Q>>>0}let M=s,V=d,C=u,W=c,l=p,b=h,v=f,T=m;for(let g=0;g<64;g++){let x=w(l,6)^w(l,11)^w(l,25),A=l&b^~l&v,S=T+x+A+mn[g]+y[g]>>>0,Q=w(M,2)^w(M,13)^w(M,22),F=M&V^M&C^V&C,nn=Q+F>>>0;T=v,v=b,b=l,l=W+S>>>0,W=C,C=V,V=M,M=S+nn>>>0}s=s+M>>>0,d=d+V>>>0,u=u+C>>>0,c=c+W>>>0,p=p+l>>>0,h=h+b>>>0,f=f+v>>>0,m=m+T>>>0}let _=E=>E.toString(16).padStart(8,"0");return _(s)+_(d)+_(u)+_(c)+_(p)+_(h)+_(f)+_(m)}function ke(r){let e=xe(r??null),n=JSON.stringify(e);return gn(n).slice(0,16)}function yn(){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 Ne(r,e,n){let t=n?.id??yn();if(r===0)return{id:t,version:0};let o=(n?.hash??ke)(e);return{id:t,version:0,cid:o,prev:null}}function Ue(r,e,n){r.version+=1,"cid"in r&&(r.prev=r.cid,r.cid=n(e))}var mn,bn,$e=O(()=>{"use strict";mn=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]),bn=new TextEncoder});function qe(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 ce(r){return r.length===0?r:typeof r[0]=="symbol"?[r]:r}function oe(r,e,n){let t=Ye(r)?r:[],i=typeof r=="function"?r:typeof e=="function"?e:void 0,o={};return Ye(r)?o=(Ee(e)?e:n)??{}:Ee(r)?o=r:o=(Ee(e)?e:n)??{},new fe(t,i,o)}var We,je,_n,vn,Ae,fe,Ye,Ee,Re=O(()=>{"use strict";ze();Fe();Y();we();He();Be();U();$e();We=()=>{},je=100;_n=(r,e,n,t)=>{n.direction==="down-in"&&r._onDepMessage(n.depIndex,e)},vn=(r,e,n,t)=>{let i=r;if(i._status==="completed"||i._status==="errored")return;let o=i._cached,a=o===void 0?[_e]:[_e,[k,o]];i._status==="dirty"&&a.push(J),de(e,a,i._config.tierOf)},Ae=new le({onMessage:_n,onSubscribe:vn});Ge(Ae);Ke(Ae);fe=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??Ae,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??ke;let i=t.versioning??this._config.defaultVersioning;this._versioningLevel=i,this._versioning=i!=null?Ne(i,this._cached===void 0?void 0:this._cached,{id:t.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(qe);let o={};for(let[s,d]of Object.entries(t.meta??{})){let u={initial:d,name:`${t.name??"node"}:meta:${s}`,describeKind:"state",config:this._config};t.guard!=null&&(u.guard=t.guard),o[s]=new r([],void 0,u)}Object.freeze(o),this.meta=o,this._hasMeta=Object.keys(o).length>0;let a=this;this._actions={emit(s){a._emit([[k,s]])},down(s){a._emit(ce(s))},up(s){a._emitUp(ce(s))}},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 i=n?.hash??this._hashFn;i!==this._hashFn&&(this._hashFn=i);let o=this._cached===void 0?void 0:this._cached,a=this._versioning,s=a?.id??n?.id,d=a?.version??0,u=Ne(e,o,{id:s,hash:i});u.version=d,this._versioning=u,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=ue(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 i=ue(e?.actor),o=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(i,o))throw new X({actor:i,action:o,nodeName:this.name});if(this._extraGuards!=null){for(let a of this._extraGuards)if(!a(i,o))throw new X({actor:i,action:o,nodeName:this.name})}this._lastMutation={actor:i,timestamp_ns:Pe()}}down(e,n){let t=ce(e);t.length!==0&&(this._checkGuard(n),this._emit(t))}emit(e,n){this._checkGuard(n),this._emit([[k,e]])}up(e,n){if(this._deps.length===0)return;let t=ce(e);if(t.length===0)return;this._checkGuard(n);let i=n??{internal:!0};this._validateUpTiers(t);for(let o of this._deps)o.node.up?.(t,i)}_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 i=n(t[0]);if(i===3||i===4)throw new Error(`Node "${this.name}": tier-${i} 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 d=ue(n);if(!this._guard(d,"observe"))throw new X({actor:d,action:"observe",nodeName:this.name})}let i=this._isTerminal&&this._resubscribable;if(i){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 d of this._deps)Me(d);if(this._partial===!1){for(let d of this._deps)if(d.prevData!==void 0||d.dataBatch.length!==0||d.terminal!==void 0||d.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let o;try{o=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:i},this._actions)}catch(d){throw this._sinkCount-=1,d}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let a=this._isTerminal;if(this._sinkCount===1&&!a)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof o=="function")try{o()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let s=!1;return()=>{s||(s=!0,this._sinkCount-=1,this._removeSink(e),typeof o=="function"&&o(),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 i=t,o=this._deps[t];o.unsub=We,o.unsub=o.node.subscribe(a=>{if(o.unsub===null)return;let s=this._config.tierOf,d=!1;for(let u of a)s(u[0])>=3&&(d=!0),this._config.onMessage(this,u,{direction:"down-in",depIndex:i},this._actions);d&&this._maybeRunFnOnSettlement()}),n++}}catch(t){this._deps[n].unsub=null;for(let i=0;i<n;i++){let o=this._deps[i];if(o.unsub!=null){let a=o.unsub;o.unsub=null;try{a()}catch{}Me(o)}}throw this._dirtyDepCount=0,t}}_addDep(e){for(let i=0;i<this._deps.length;i++)if(this._deps[i].node===e)return i;let n=this._deps.length,t=qe(e);if(this._deps.push(t),this._sinks==null)return n;t.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(ve),t.unsub=We;try{t.unsub=e.subscribe(i=>{if(t.unsub===null)return;let o=this._config.tierOf,a=!1;for(let s of i)o(s[0])>=3&&(a=!0),this._config.onMessage(this,s,{direction:"down-in",depIndex:n},this._actions);a&&this._maybeRunFnOnSettlement()})}catch(i){throw t.unsub=null,this._deps.pop(),this._dirtyDepCount--,i}return n}_deactivate(e=!1){let n=this._cleanup;if(this._cleanup=void 0,typeof n=="function")try{n()}catch(t){this._emit([[N,this._wrapFnError("cleanup threw",t)]])}else if(n!=null&&typeof n=="object"){let t=n.deactivate;if(typeof t=="function")try{t()}catch(i){this._emit([[N,this._wrapFnError("cleanup.deactivate threw",i)]])}}for(let t of this._deps){if(t.unsub!=null){let i=t.unsub;t.unsub=null;try{i()}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],i=n[0];if(this._inspectorHooks!=null){let o={kind:"dep_message",depIndex:e,message:n};for(let a of this._inspectorHooks)a(o)}if(i!==te){if(i===R){this._depDirtied(t);return}if(i===H){if(this._depInvalidated(t),this._cached===void 0)return;this._emit(De);return}if(i===B||i===re){this._emit([n]);return}if(i===z){this._emit(Te);return}if(i===k)this._depSettledAsData(t,n[1]);else if(i===I)this._depSettledAsResolved(t);else if(i===D)this._depSettledAsTerminal(t,!0);else if(i===N)this._depSettledAsTerminal(t,n[1]);else{this._emit([n]);return}if(!this._fn){(i===k||i===I)&&this._emit([n]),(i===D||i===N)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(ve))}_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(Ie),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([[N,e.terminal]]);return}this._autoComplete&&this._deps.every(n=>n.terminal!==void 0)&&this._emit(Le)}_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(a){this._emit([[N,this._wrapFnError("cleanup threw",a)]]);return}}else if(e!=null&&typeof e=="object"){let a=e.beforeRun;if(typeof a=="function"){e.beforeRun=void 0;try{a()}catch(s){this._emit([[N,this._wrapFnError("cleanup.beforeRun threw",s)]]);return}}}let n=this._deps.map(a=>a.involvedThisWave?a.dataBatch.length>0?[...a.dataBatch]:[]:void 0),t=this._deps.map(a=>a.prevData);for(let a=0;a<this._deps.length;a++){let s=n[a];s!=null&&s.length>0&&(this._deps[a].prevData=s[s.length-1])}let i=this._deps.map(a=>a.terminal),o={prevData:t,terminalDeps:i,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let a={kind:"run",batchData:n,prevData:t};for(let s of this._inspectorHooks)s(a)}this._isExecutingFn=!0;try{let a=this._fn(n,this._actions,o);if(typeof a=="function")this._cleanup=a;else if(a!=null&&typeof a=="object"){let s=a;(typeof s.beforeRun=="function"||typeof s.deactivate=="function"||typeof s.invalidate=="function")&&(this._cleanup=a)}}catch(a){this._emit([[N,this._wrapFnError("fn threw",a)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>je?(this._rerunDepth=0,this._emit([[N,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${je} \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"?[J,e[0]]:e;let t=!0,i=!1,o=!1,a=-1;for(let d of e){let u=n(d[0]);u<a&&(t=!1),u===3&&(i=!0),d[0]===R&&(o=!0),a=u}let s=e;if(!t){let d=e.map((u,c)=>({m:u,i:c,tier:n(u[0])}));d.sort((u,c)=>u.tier-c.tier||u.i-c.i),s=d.map(u=>u.m)}if(i&&!o&&this._status!=="dirty"){let d=0;for(;d<s.length&&n(s[d][0])===0;)d++;return d===0?[J,...s]:[...s.slice(0,d),J,...s.slice(d)]}return s}_emit(e){if(e.length===0)return;for(let s=0;s<e.length;s++){let d=e[s];if(d[0]===N&&d[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 s=e.filter(d=>d[0]===z||d[0]===H);if(s.length===0)return;n=s}n=this._frameBatch(n);let i=null;for(let s=0;s<n.length;s++){let d=n[s],u=d[0];if(u!==B&&u!==re){i?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${u===B?"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 p=d[1];if(u===B)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(p),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(p))c=!1;else if(this._pauseLocks.delete(p),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let h=this._pauseBuffer;this._pauseBuffer=[],this._emit(h)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?i?.push(d):i==null&&(i=n.slice(0,s))}if(i!=null){if(i.length===0)return;n=i}if(this._hasMeta&&n.some(s=>s[0]===z))for(let s of Object.keys(this.meta))try{this.meta[s]._emit(Te)}catch{}let{finalMessages:o,equalsError:a}=this._updateState(n);if(o.length>0&&this._config.inspectorEnabled){let s=this._config.globalInspector;if(s!=null)try{s({kind:"emit",node:this,messages:o})}catch{}}if(o.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let s=this._config.tierOf,d=[];for(let u of o)s(u[0])===3?this._pauseBuffer.push(u):d.push(u);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(o);a!=null&&this._emit([[N,a]])}_updateState(e){let n=this._config.tierOf,t,i,o=-1,a=0;for(let c of e)n(c[0])===3&&a++;let s=a<=1,d=-1;if(this._versioning!=null&&a>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===k){d=c;break}}for(let c=0;c<e.length;c++){let p=e[c],h=p[0];if(h===k){if(p.length>=2){let f=!1;if(s&&this._cached!==void 0)try{f=this._equals(this._cached,p[1])}catch(m){i=this._wrapFnError("equals threw",m),o=c;break}if(f){t==null&&(t=e.slice(0,c)),t.push(ye),this._status="resolved";continue}this._cached=p[1],this._versioning!=null&&(d<0||c===d)&&Ue(this._versioning,p[1],this._hashFn)}this._status="settled",t?.push(p)}else if(t?.push(p),h===R)this._status="dirty";else if(h===I)this._status="resolved";else if(h===D){this._status="completed";{let f=this._config.rigorRecorder;if(f!=null)try{f.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(h===N){this._status="errored";{let f=this._config.rigorRecorder;if(f!=null)try{f.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(h===H){if(this._cached!==void 0){let m=this._config.rigorRecorder;if(m!=null)try{m.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let f=this._cleanup;if(typeof f=="function"){this._cleanup=void 0;try{f()}catch{}}else if(f!=null&&typeof f=="object"){let m=f.invalidate;if(typeof m=="function")try{m()}catch{}}}else h===z&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let u=o>=0?t??e.slice(0,o):t??e;return i!=null?{finalMessages:u,equalsError:i}:{finalMessages:u}}_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(Ve()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Ce(()=>this._flushBatchPending()));for(let n of e)this._batchPendingMessages.push(n);return}de(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);de(this._deliverToSinks,n,this._config.tierOf)}},Ye=r=>Array.isArray(r),Ee=r=>typeof r=="object"&&r!=null&&!Array.isArray(r)});function L(r,e){return oe([],{...e,initial:r})}function $(r,e,n){return oe(r,(i,o,a)=>{let s=i.map((d,u)=>d!=null&&d.length>0?d.at(-1):a.prevData[u]);o.emit(e(s,a))},{describeKind:"derived",...n})}var se=O(()=>{"use strict";Re()});function Ze(r){return r.subscribe(()=>{})}var Qe=O(()=>{"use strict"});var en=O(()=>{"use strict";Qe()});var Rn={};sn(Rn,{NativeIndexBackend:()=>he,NativeListBackend:()=>pe,NativeLogBackend:()=>me,NativeMapBackend:()=>be,mergeReactiveLogs:()=>En,reactiveIndex:()=>xn,reactiveList:()=>kn,reactiveLog:()=>Mn,reactiveMap:()=>An});module.exports=dn(Rn);Y();U();se();function Je(r,e){if(r===e)return 0;let n=typeof r;if(n===typeof e&&(n==="number"||n==="string"||n==="boolean"||n==="bigint")){let i=r,o=e;return i<o?-1:i>o?1:0}return String(r).localeCompare(String(e))}function Tn(r,e){let n=Je(r[0],e[0]);return n!==0?n:Je(r[1],e[1])}function Xe(r){return[r.secondary,r.primary]}function Z(r,e){let n=Xe(e),t=0,i=r.length;for(;t<i;){let o=t+i>>1;Tn(n,Xe(r[o]))>0?t=o+1:i=o}return t}var he=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,i){let o=this._byPrimary.get(e),a={primary:e,secondary:n,value:t};if(o!==void 0&&i?.equals?.(o,a))return!1;if(o!==void 0){let d=Z(this._buf,o);this._buf.splice(d,1)}let s=Z(this._buf,a);return this._buf.splice(s,0,a),this._byPrimary.set(e,a),this._version+=1,o===void 0}upsertMany(e,n){let t=0;try{for(let i of e){let o=this._byPrimary.get(i.primary),a={primary:i.primary,secondary:i.secondary,value:i.value};if(o!==void 0&&n?.equals?.(o,a))continue;if(o!==void 0){let d=Z(this._buf,o);this._buf.splice(d,1)}let s=Z(this._buf,a);this._buf.splice(s,0,a),this._byPrimary.set(i.primary,a),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=Z(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 i=this._byPrimary.get(t);if(i===void 0)continue;let o=Z(this._buf,i);this._buf.splice(o,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 wn(r){return r.subscribe(()=>{})}function xn(r={}){let{name:e,versioning:n,equals:t,backend:i}=r,o=i??new he;function a(f){return f?.equals!==void 0||t===void 0?f:{...f,equals:t}}let s=L([],{name:e,describeKind:"state",equals:(f,m)=>f===m,...n!=null?{versioning:n}:{}}),d=$([s],([f])=>{let m=f,y=new Map;for(let w of m)y.set(w.primary,w.value);return y},{initial:o.toPrimaryMap(),describeKind:"derived"}),u=wn(d),c=!1;function p(){let f=o.toArray();K(()=>{s.down([[R]]),s.down([[k,f]])})}function h(f){let m=o.version;try{return f()}finally{o.version!==m&&p()}}return{ordered:s,byPrimary:d,has(f){return o.has(f)},get(f){return o.get(f)},get size(){return o.size},upsert(f,m,y,w){return h(()=>o.upsert(f,m,y,a(w)))},upsertMany(f,m){let y=[...f];y.length!==0&&h(()=>o.upsertMany(y,a(m)))},delete(f){h(()=>o.delete(f))},deleteMany(f){let m=[...f];m.length!==0&&h(()=>o.deleteMany(m))},clear(){h(()=>o.clear())},dispose(){c||(c=!0,u())}}}Y();U();se();var pe=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 kn(r,e={}){let{name:n,versioning:t,backend:i}=e,o=i??new pe(r),a=L(o.toArray(),{name:n,describeKind:"state",equals:(u,c)=>u===c,...t!=null?{versioning:t}:{}});function s(){let u=o.toArray();K(()=>{a.down([[R]]),a.down([[k,u]])})}function d(u){let c=o.version;try{return u()}finally{o.version!==c&&s()}}return{items:a,get size(){return o.size},at(u){return o.at(u)},append(u){d(()=>o.append(u))},appendMany(u){d(()=>o.appendMany(u))},insert(u,c){d(()=>o.insert(u,c))},insertMany(u,c){d(()=>o.insertMany(u,c))},pop(u=-1){return d(()=>o.pop(u))},clear(){d(()=>o.clear())},dispose(){}}}Y();U();Re();se();en();var me=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),i=e.length-t;for(let o=0;o<t;o++)this._buf[o]=e[i+o];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),i=Math.min(e,this._size);if(i>=t)return[];let o=t-i;if(this._maxSize===void 0)return this._buf.slice(i,t);let a=new Array(o);for(let s=0;s<o;s++)a[s]=this._buf[(this._head+i+s)%this._maxSize];return a}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}snapshot(){return this.toArray()}restore(e){if(this._maxSize===void 0){this._buf.length=0;for(let n=0;n<e.length;n++)this._buf.push(e[n]);this._size=this._buf.length}else{let n=this._maxSize;for(let o=0;o<n;o++)this._buf[o]=void 0;this._head=0;let t=Math.min(e.length,n),i=e.length-t;for(let o=0;o<t;o++)this._buf[o]=e[i+o];this._size=t}this._version+=1}_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 ae(r){return r.subscribe(()=>{})}var Nn=64;function Mn(r,e={}){let{name:n,maxSize:t,versioning:i,guard:o,backend:a}=e,s=a??new me(r,t),d=L(s.toArray(),{name:n,describeKind:"state",equals:(l,b)=>l===b,...i!=null?{versioning:i}:{},...o!=null?{guard:o}:{}});function u(){let l=s.toArray();K(()=>{d.down([[R]],{internal:!0}),d.down([[k,l]],{internal:!0})})}let c=new Map,p=new Map,h=new Map;function f(l,b){return`${l}:${b===void 0?"END":b}`}function m(l){if(l.size<Nn)return;let b=l.keys().next();if(b.done)return;let v=l.get(b.value);v!==void 0&&v.dispose(),l.delete(b.value)}function y(l){let b=s.version;try{return l()}finally{s.version!==b&&u()}}function w(l){if(!Number.isInteger(l)||l<0)throw new RangeError(`tail: n must be a non-negative integer (got ${l})`);let b=c.get(l);if(b!==void 0)return c.delete(l),c.set(l,b),b.node;m(c);let v=$([d],([g])=>{let x=g;return l===0||x.length===0?[]:x.slice(Math.max(0,x.length-l))},{initial:s.tail(l),describeKind:"derived"}),T=ae(v);return c.set(l,{node:v,dispose:T}),v}function _(l,b){if(!Number.isInteger(l)||l<0)throw new RangeError(`slice: start must be a non-negative integer (got ${l})`);if(b!==void 0&&(!Number.isInteger(b)||b<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${b})`);let v=f(l,b),T=p.get(v);if(T!==void 0)return p.delete(v),p.set(v,T),T.node;m(p);let g=$([d],([A])=>{let S=A;return b===void 0?S.slice(l):S.slice(l,b)},{initial:s.slice(l,b),describeKind:"derived"}),x=ae(g);return p.set(v,{node:g,dispose:x}),g}function E(l){let b=h.get(l);if(b!==void 0)return b.node;let v=$([d,l],([g,x])=>{let A=g,S=Math.max(0,Math.trunc(x??0));return A.slice(S)},{initial:[],describeKind:"derived"}),T=ae(v);return h.set(l,{node:v,dispose:T}),v}let M,V;function C(){M===void 0&&(M=oe([d],(l,b,v)=>{let T=l[0],x=T!=null&&T.length>0?T.at(-1):v.prevData[0];if(x==null||x.length===0){b.down([[I]]);return}b.emit(x[x.length-1])},{name:n!=null?`${n}::lastValue`:"lastValue",describeKind:"derived",initial:s.size===0?void 0:s.at(s.size-1)}),V=$([d],([l])=>l.length>0,{name:n!=null?`${n}::hasLatest`:"hasLatest",describeKind:"derived",initial:s.size>0}),ae(M),ae(V))}let W={entries:d,get size(){return s.size},at(l){return s.at(l)},append(l){y(()=>s.append(l))},appendMany(l){l.length!==0&&y(()=>s.appendMany(l))},clear(){y(()=>s.clear())},trimHead(l){y(()=>s.trimHead(l))},withLatest(){return C(),d},get lastValue(){return C(),M},get hasLatest(){return C(),V},view(l){switch(l.kind){case"tail":return w(l.n);case"slice":return _(l.start,l.stop);case"fromCursor":return E(l.cursor)}},attach(l){let b=l.subscribe(v=>{for(let T of v)T[0]===k&&W.append(T[1])});return()=>b()},attachStorage(l){if(l.length===0)return()=>{};let b=new Map;for(let T of l)b.set(T,s.size);(async()=>{for(let T of l)if(typeof T.loadEntries=="function")try{let g=await Promise.resolve(T.loadEntries());g.entries.length>0&&s.size===0&&(s.restore(g.entries),b.set(T,g.entries.length),u());break}catch{}})();let v=d.subscribe(T=>{for(let g of T){if(g[0]!==k)continue;let x=g[1];for(let A of l){let S=b.get(A)??0;if(x.length<S){try{let F=A.appendEntries(x);F instanceof Promise&&F.catch(()=>{})}catch{}b.set(A,x.length);continue}if(x.length===S)continue;let Q=x.slice(S);b.set(A,x.length);try{let F=A.appendEntries(Q);F instanceof Promise&&F.catch(()=>{})}catch{}}}});return()=>v()},disposeAllViews(){for(let l of c.values())l.dispose();c.clear();for(let l of p.values())l.dispose();p.clear();for(let l of h.values())l.dispose();h.clear()},dispose(){for(let l of c.values())l.dispose();c.clear();for(let l of p.values())l.dispose();p.clear();for(let l of h.values())l.dispose();h.clear()}};return W}var Se=new WeakMap;function En(r){let e=Se.get(r);if(e)return e;let n=r.map(c=>c.cache??[]),t=n.flat(),i=L(t,{name:"mergeReactiveLogs",describeKind:"state",equals:(c,p)=>c===p}),o=r.map((c,p)=>[...n[p]??[]]),a=[];for(let c=0;c<r.length;c++){let p=c,h=r[p].subscribe(f=>{for(let m of f)if(m[0]===k)o[p]=[...m[1]],i.emit(o.flat());else if(m[0]===D){o[p]=[];let y=a[p];y!==void 0&&(a[p]=void 0,y())}else m[0]===N&&i.down([[N,m[1]]])});a.push(h)}let s=Ze(i),d=!1,u={node:i,dispose(){if(!d){d=!0;for(let c of a)c?.();a.length=0,s(),Se.delete(r)}}};return Se.set(r,u),u}Y();we();U();se();var be=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 i=this._resolveExpiresAt(t);this._store.has(e)&&this._store.delete(e),this._store.set(e,{value:n,expiresAt:i}),this._evictLruWhileOver(),this._version+=1}setMany(e,n){let t=this._resolveExpiresAt(n),i=0;try{for(let[o,a]of e)this._store.has(o)&&this._store.delete(o),this._store.set(o,{value:a,expiresAt:t}),i+=1}finally{i>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=ie(),n=0;for(let[t,i]of this._store)this._isExpired(i,e)&&(this._store.delete(t),n+=1);return n>0&&(this._version+=1),n}toMap(){let e=ie(),n=new Map;for(let[t,i]of this._store)this._isExpired(i,e)||n.set(t,i.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 ie()+n*1e9}}_isExpired(e,n){return e.expiresAt===void 0?!1:(n??ie())>=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 An(r={}){let{name:e,maxSize:n,defaultTtl:t,versioning:i,backend:o,retention:a}=r;if(a&&n!==void 0)throw new RangeError("reactiveMap: `maxSize` (LRU) and `retention` (score-based) are mutually exclusive. Pick one eviction policy.");if(a&&a.archiveThreshold===void 0&&a.maxSize===void 0)throw new RangeError("reactiveMap: `retention` requires at least one of `archiveThreshold` or `maxSize` to trigger archival.");let s=o??new be({maxSize:n,defaultTtl:t}),d=L(s.toMap(),{name:e,describeKind:"state",equals:(h,f)=>h===f,...i!=null?{versioning:i}:{}});function u(){let h=s.toMap();K(()=>{d.down([[R]]),d.down([[k,h]])})}function c(){if(!a)return;let h=s.toMap(),f=a.archiveThreshold,m=a.maxSize,y=[];for(let[_,E]of h)y.push({key:_,value:E,score:a.score(_,E)});y.sort((_,E)=>_.score-E.score);let w=new Set;if(f!==void 0)for(let _ of y)if(_.score<f)w.add(_.key);else break;if(m!==void 0&&y.length-w.size>m)for(let _ of y){if(y.length-w.size<=m)break;w.has(_.key)||w.add(_.key)}if(w.size!==0)for(let _ of y)w.has(_.key)&&(a.onArchive?.(_.key,_.value,_.score),s.delete(_.key))}function p(h,f="mutation"){let m=s.version;try{return h()}finally{s.version!==m&&(f==="mutation"&&c(),u())}}return{entries:d,has(h){return p(()=>s.has(h),"read")},get(h){return p(()=>s.get(h),"read")},set(h,f,m){p(()=>s.set(h,f,m?.ttl))},setMany(h,f){p(()=>s.setMany(h,f?.ttl))},delete(h){p(()=>s.delete(h))},deleteMany(h){p(()=>s.deleteMany(h))},clear(){p(()=>s.clear())},pruneExpired(){p(()=>s.pruneExpired())},get size(){return s.size},dispose(){}}}0&&(module.exports={NativeIndexBackend,NativeListBackend,NativeLogBackend,NativeMapBackend,mergeReactiveLogs,reactiveIndex,reactiveList,reactiveLog,reactiveMap});
|
|
1
|
+
"use strict";var ge=Object.defineProperty;var tn=Object.getOwnPropertyDescriptor;var rn=Object.getOwnPropertyNames;var on=Object.prototype.hasOwnProperty;var O=(r,e)=>()=>(r&&(e=r(r=0)),e);var sn=(r,e)=>{for(var n in e)ge(r,n,{get:e[n],enumerable:!0})},an=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of rn(e))!on.call(r,o)&&o!==n&&ge(r,o,{get:()=>e[o],enumerable:!(t=tn(e,o))||t.enumerable});return r};var dn=r=>an(ge({},"__esModule",{value:!0}),r);function Oe(){return j>0||ee}function Ve(){return j>0}function Ce(r){j>0?ne.push(r):r()}function K(r){j+=1;let e=!1;try{r()}catch(n){throw e=!0,n}finally{if(j-=1,j===0)if(e){if(!ee){let n=ne.splice(0);for(let t of n)try{t()}catch{}P.length=0,G.length=0,q.length=0}}else un()}}function un(){let r=!ee;r&&(ee=!0);let e=[],n=0;try{for(;P.length>0||G.length>0||q.length>0||r&&ne.length>0;){if(r&&ne.length>0){let i=ne.splice(0);for(let a of i)try{a()}catch(s){e.push(s)}continue}if(n+=1,n>1e3)throw P.length=0,G.length=0,q.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let o=(P.length>0?P:G.length>0?G:q).splice(0);for(let i of o)try{i()}catch(a){e.push(a)}}}finally{r&&(ee=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function de(r,e,n){if(e.length===0)return;if(e.length===1){let u=n(e[0][0]);if(u<3||!Oe()){r(e);return}(u>=5?q:u===4?G:P).push(()=>r(e));return}let t=e.length,o=t,i=t,a=t,s=0;for(;s<t&&n(e[s][0])<3;)s++;for(o=s;s<t&&n(e[s][0])===3;)s++;for(i=s;s<t&&n(e[s][0])===4;)s++;a=s;let d=Oe();if(o>0){let u=e.slice(0,o);r(u)}if(i>o){let u=e.slice(o,i);d?P.push(()=>r(u)):r(u)}if(a>i){let u=e.slice(i,a);d?G.push(()=>r(u)):r(u)}if(t>a){let u=e.slice(a,t);d?q.push(()=>r(u)):r(u)}}var j,ee,P,G,q,ne,Y=O(()=>{"use strict";j=0,ee=!1,P=[],G=[],q=[],ne=[]});var te,N,R,D,H,B,re,F,I,k,J,ye,ln,_e,cn,fn,ve,De,Ie,Le,Te,U=O(()=>{"use strict";te=Symbol.for("graphrefly/START"),N=Symbol.for("graphrefly/DATA"),R=Symbol.for("graphrefly/DIRTY"),D=Symbol.for("graphrefly/RESOLVED"),H=Symbol.for("graphrefly/INVALIDATE"),B=Symbol.for("graphrefly/PAUSE"),re=Symbol.for("graphrefly/RESUME"),F=Symbol.for("graphrefly/TEARDOWN"),I=Symbol.for("graphrefly/COMPLETE"),k=Symbol.for("graphrefly/ERROR"),J=Object.freeze([R]),ye=Object.freeze([D]),ln=Object.freeze([H]),_e=Object.freeze([te]),cn=Object.freeze([I]),fn=Object.freeze([F]),ve=Object.freeze([J]),De=Object.freeze([ye]),Ie=Object.freeze([ln]),Le=Object.freeze([cn]),Te=Object.freeze([fn])});function Ke(r){r.registerCodec(hn)}var hn,Fe=O(()=>{"use strict";hn={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 ue(r){if(r==null)return pn;let{type:e,id:n,...t}=r;return{type:e??"system",id:n??"",...t}}var pn,ze=O(()=>{"use strict";pn={type:"system",id:""}});function oe(){return Math.trunc(performance.now()*1e6)}function Pe(){return Date.now()*1e6}var we=O(()=>{"use strict"});function Ge(r){r.registerMessageType(te,{tier:0,wireCrossing:!1}),r.registerMessageType(R,{tier:1,wireCrossing:!1}),r.registerMessageType(H,{tier:1,wireCrossing:!1,metaPassthrough:!1}),r.registerMessageType(B,{tier:2,wireCrossing:!1}),r.registerMessageType(re,{tier:2,wireCrossing:!1}),r.registerMessageType(N,{tier:3,wireCrossing:!0}),r.registerMessageType(D,{tier:3,wireCrossing:!0}),r.registerMessageType(I,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(k,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(F,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var le,He=O(()=>{"use strict";U();le=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_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}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=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 X,Be=O(()=>{"use strict";X=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 xe(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(xe);if(typeof r=="object"&&r!==null){let e={};for(let n of Object.keys(r).sort())e[n]=xe(r[n]);return e}return null}function gn(r){let e=bn.encode(r),n=e.length,t=n*8,o=n+9+63&-64,i=new Uint8Array(o);i.set(e),i[n]=128;let a=new DataView(i.buffer);a.setUint32(o-4,t>>>0,!1),a.setUint32(o-8,Math.floor(t/4294967296)>>>0,!1);let s=1779033703,d=3144134277,u=1013904242,c=2773480762,p=1359893119,h=2600822924,f=528734635,m=1541459225,y=new Uint32Array(64),w=(E,M)=>E>>>M|E<<32-M;for(let E=0;E<o;E+=64){for(let g=0;g<16;g++)y[g]=a.getUint32(E+g*4,!1);for(let g=16;g<64;g++){let x=y[g-15],A=y[g-2],S=w(x,7)^w(x,18)^x>>>3,Q=w(A,17)^w(A,19)^A>>>10;y[g]=y[g-16]+S+y[g-7]+Q>>>0}let M=s,V=d,C=u,W=c,l=p,b=h,v=f,T=m;for(let g=0;g<64;g++){let x=w(l,6)^w(l,11)^w(l,25),A=l&b^~l&v,S=T+x+A+mn[g]+y[g]>>>0,Q=w(M,2)^w(M,13)^w(M,22),z=M&V^M&C^V&C,nn=Q+z>>>0;T=v,v=b,b=l,l=W+S>>>0,W=C,C=V,V=M,M=S+nn>>>0}s=s+M>>>0,d=d+V>>>0,u=u+C>>>0,c=c+W>>>0,p=p+l>>>0,h=h+b>>>0,f=f+v>>>0,m=m+T>>>0}let _=E=>E.toString(16).padStart(8,"0");return _(s)+_(d)+_(u)+_(c)+_(p)+_(h)+_(f)+_(m)}function Ne(r){let e=xe(r??null),n=JSON.stringify(e);return gn(n).slice(0,16)}function yn(){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 ke(r,e,n){let t=n?.id??yn();if(r===0)return{id:t,version:0};let i=(n?.hash??Ne)(e);return{id:t,version:0,cid:i,prev:null}}function Ue(r,e,n){r.version+=1,"cid"in r&&(r.prev=r.cid,r.cid=n(e))}var mn,bn,$e=O(()=>{"use strict";mn=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]),bn=new TextEncoder});function qe(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 ce(r){return r.length===0?r:typeof r[0]=="symbol"?[r]:r}function ie(r,e,n){let t=Ye(r)?r:[],o=typeof r=="function"?r:typeof e=="function"?e:void 0,i={};return Ye(r)?i=(Ee(e)?e:n)??{}:Ee(r)?i=r:i=(Ee(e)?e:n)??{},new fe(t,o,i)}var We,je,_n,vn,Ae,fe,Ye,Ee,Re=O(()=>{"use strict";Fe();ze();Y();we();He();Be();U();$e();We=()=>{},je=100;_n=(r,e,n,t)=>{n.direction==="down-in"&&r._onDepMessage(n.depIndex,e)},vn=(r,e,n,t)=>{let o=r;if(o._status==="completed"||o._status==="errored")return;let i=o._cached,a=i===void 0?[_e]:[_e,[N,i]];o._status==="dirty"&&a.push(J),de(e,a,o._config.tierOf)},Ae=new le({onMessage:_n,onSubscribe:vn});Ge(Ae);Ke(Ae);fe=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??Ae,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??Ne;let o=t.versioning??this._config.defaultVersioning;this._versioningLevel=o,this._versioning=o!=null?ke(o,this._cached===void 0?void 0:this._cached,{id:t.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(qe);let i={};for(let[s,d]of Object.entries(t.meta??{})){let u={initial:d,name:`${t.name??"node"}:meta:${s}`,describeKind:"state",config:this._config};t.guard!=null&&(u.guard=t.guard),t.resubscribable===!0&&(u.resubscribable=!0),i[s]=new r([],void 0,u)}Object.freeze(i),this.meta=i,this._hasMeta=Object.keys(i).length>0;let a=this;this._actions={emit(s){a._emit([[N,s]])},down(s){a._emit(ce(s))},up(s){a._emitUp(ce(s))}},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 o=n?.hash??this._hashFn;o!==this._hashFn&&(this._hashFn=o);let i=this._cached===void 0?void 0:this._cached,a=this._versioning,s=a?.id??n?.id,d=a?.version??0,u=ke(e,i,{id:s,hash:o});u.version=d,this._versioning=u,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=ue(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 o=ue(e?.actor),i=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(o,i))throw new X({actor:o,action:i,nodeName:this.name});if(this._extraGuards!=null){for(let a of this._extraGuards)if(!a(o,i))throw new X({actor:o,action:i,nodeName:this.name})}this._lastMutation={actor:o,timestamp_ns:Pe()}}down(e,n){let t=ce(e);t.length!==0&&(this._checkGuard(n),this._emit(t))}emit(e,n){this._checkGuard(n),this._emit([[N,e]])}up(e,n){if(this._deps.length===0)return;let t=ce(e);if(t.length===0)return;this._checkGuard(n);let o=n??{internal:!0};this._validateUpTiers(t);for(let i of this._deps)i.node.up?.(t,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 t of e){let o=n(t[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 d=ue(n);if(!this._guard(d,"observe"))throw new X({actor:d,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 d of this._deps)Me(d);if(this._partial===!1){for(let d of this._deps)if(d.prevData!==void 0||d.dataBatch.length!==0||d.terminal!==void 0||d.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(d){throw this._sinkCount-=1,d}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let a=this._isTerminal;if(this._sinkCount===1&&!a)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof i=="function")try{i()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let s=!1;return()=>{s||(s=!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 o=t,i=this._deps[t];i.unsub=We,i.unsub=i.node.subscribe(a=>{if(i.unsub===null)return;let s=this._config.tierOf,d=!1;for(let u of a)s(u[0])>=3&&(d=!0),this._config.onMessage(this,u,{direction:"down-in",depIndex:o},this._actions);d&&this._maybeRunFnOnSettlement()}),n++}}catch(t){this._deps[n].unsub=null;for(let o=0;o<n;o++){let i=this._deps[o];if(i.unsub!=null){let a=i.unsub;i.unsub=null;try{a()}catch{}Me(i)}}throw this._dirtyDepCount=0,t}}_addDep(e){for(let o=0;o<this._deps.length;o++)if(this._deps[o].node===e)return o;let n=this._deps.length,t=qe(e);if(this._deps.push(t),this._sinks==null)return n;t.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(ve),t.unsub=We;try{t.unsub=e.subscribe(o=>{if(t.unsub===null)return;let i=this._config.tierOf,a=!1;for(let s of o)i(s[0])>=3&&(a=!0),this._config.onMessage(this,s,{direction:"down-in",depIndex:n},this._actions);a&&this._maybeRunFnOnSettlement()})}catch(o){throw t.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(t){this._emit([[k,this._wrapFnError("cleanup threw",t)]])}else if(n!=null&&typeof n=="object"){let t=n.deactivate;if(typeof t=="function")try{t()}catch(o){this._emit([[k,this._wrapFnError("cleanup.deactivate threw",o)]])}}for(let t of this._deps){if(t.unsub!=null){let o=t.unsub;t.unsub=null;try{o()}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],o=n[0];if(this._inspectorHooks!=null){let i={kind:"dep_message",depIndex:e,message:n};for(let a of this._inspectorHooks)a(i)}if(o!==te){if(o===R){this._depDirtied(t);return}if(o===H){if(this._depInvalidated(t),this._cached===void 0)return;this._emit(Ie);return}if(o===B||o===re){this._emit([n]);return}if(o===F){this._emit(Te);return}if(o===N)this._depSettledAsData(t,n[1]);else if(o===D)this._depSettledAsResolved(t);else if(o===I)this._depSettledAsTerminal(t,!0);else if(o===k)this._depSettledAsTerminal(t,n[1]);else{this._emit([n]);return}if(!this._fn){(o===N||o===D)&&this._emit([n]),(o===I||o===k)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(ve))}_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(De),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([[k,e.terminal]]);return}this._autoComplete&&this._deps.every(n=>n.terminal!==void 0)&&this._emit(Le)}_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(a){this._emit([[k,this._wrapFnError("cleanup threw",a)]]);return}}else if(e!=null&&typeof e=="object"){let a=e.beforeRun;if(typeof a=="function"){e.beforeRun=void 0;try{a()}catch(s){this._emit([[k,this._wrapFnError("cleanup.beforeRun threw",s)]]);return}}}let n=this._deps.map(a=>a.involvedThisWave?a.dataBatch.length>0?[...a.dataBatch]:[]:void 0),t=this._deps.map(a=>a.prevData);for(let a=0;a<this._deps.length;a++){let s=n[a];s!=null&&s.length>0&&(this._deps[a].prevData=s[s.length-1])}let o=this._deps.map(a=>a.terminal),i={prevData:t,terminalDeps:o,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let a={kind:"run",batchData:n,prevData:t};for(let s of this._inspectorHooks)s(a)}this._isExecutingFn=!0;try{let a=this._fn(n,this._actions,i);if(typeof a=="function")this._cleanup=a;else if(a!=null&&typeof a=="object"){let s=a;(typeof s.beforeRun=="function"||typeof s.deactivate=="function"||typeof s.invalidate=="function")&&(this._cleanup=a)}}catch(a){this._emit([[k,this._wrapFnError("fn threw",a)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>je?(this._rerunDepth=0,this._emit([[k,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${je} \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"?[J,e[0]]:e;let t=!0,o=!1,i=!1,a=-1;for(let d of e){let u=n(d[0]);u<a&&(t=!1),u===3&&(o=!0),d[0]===R&&(i=!0),a=u}let s=e;if(!t){let d=e.map((u,c)=>({m:u,i:c,tier:n(u[0])}));d.sort((u,c)=>u.tier-c.tier||u.i-c.i),s=d.map(u=>u.m)}if(o&&!i&&this._status!=="dirty"){let d=0;for(;d<s.length&&n(s[d][0])===0;)d++;return d===0?[J,...s]:[...s.slice(0,d),J,...s.slice(d)]}return s}_emit(e){if(e.length===0)return;for(let s=0;s<e.length;s++){let d=e[s];if(d[0]===k&&d[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 s=e.filter(d=>d[0]===F||d[0]===H);if(s.length===0)return;n=s}n=this._frameBatch(n);let o=null;for(let s=0;s<n.length;s++){let d=n[s],u=d[0];if(u!==B&&u!==re){o?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${u===B?"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 p=d[1];if(u===B)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(p),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(p))c=!1;else if(this._pauseLocks.delete(p),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let h=this._pauseBuffer;this._pauseBuffer=[],this._emit(h)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?o?.push(d):o==null&&(o=n.slice(0,s))}if(o!=null){if(o.length===0)return;n=o}if(this._hasMeta&&n.some(s=>s[0]===F))for(let s of Object.keys(this.meta))try{this.meta[s]._emit(Te)}catch{}let{finalMessages:i,equalsError:a}=this._updateState(n);if(i.length>0&&this._config.inspectorEnabled){let s=this._config.globalInspector;if(s!=null)try{s({kind:"emit",node:this,messages:i})}catch{}}if(i.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let s=this._config.tierOf,d=[];for(let u of i)s(u[0])===3?this._pauseBuffer.push(u):d.push(u);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(i);a!=null&&this._emit([[k,a]])}_updateState(e){let n=this._config.tierOf,t,o,i=-1,a=0;for(let c of e)n(c[0])===3&&a++;let s=a<=1,d=-1;if(this._versioning!=null&&a>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===N){d=c;break}}for(let c=0;c<e.length;c++){let p=e[c],h=p[0];if(h===N){if(p.length>=2){let f=!1;if(s&&this._cached!==void 0)try{f=this._equals(this._cached,p[1])}catch(m){o=this._wrapFnError("equals threw",m),i=c;break}if(f){t==null&&(t=e.slice(0,c)),t.push(ye),this._status="resolved";continue}this._cached=p[1],this._versioning!=null&&(d<0||c===d)&&Ue(this._versioning,p[1],this._hashFn)}this._status="settled",t?.push(p)}else if(t?.push(p),h===R)this._status="dirty";else if(h===D)this._status="resolved";else if(h===I){this._status="completed";{let f=this._config.rigorRecorder;if(f!=null)try{f.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(h===k){this._status="errored";{let f=this._config.rigorRecorder;if(f!=null)try{f.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(h===H){if(this._cached!==void 0){let m=this._config.rigorRecorder;if(m!=null)try{m.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let f=this._cleanup;if(typeof f=="function"){this._cleanup=void 0;try{f()}catch{}}else if(f!=null&&typeof f=="object"){let m=f.invalidate;if(typeof m=="function")try{m()}catch{}}}else h===F&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let u=i>=0?t??e.slice(0,i):t??e;return o!=null?{finalMessages:u,equalsError:o}:{finalMessages:u}}_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(Ve()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Ce(()=>this._flushBatchPending()));for(let n of e)this._batchPendingMessages.push(n);return}de(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);de(this._deliverToSinks,n,this._config.tierOf)}},Ye=r=>Array.isArray(r),Ee=r=>typeof r=="object"&&r!=null&&!Array.isArray(r)});function L(r,e){return ie([],{...e,initial:r})}function $(r,e,n){return ie(r,(o,i,a)=>{let s=o.map((d,u)=>d!=null&&d.length>0?d.at(-1):a.prevData[u]);i.emit(e(s,a))},{describeKind:"derived",...n})}var se=O(()=>{"use strict";Re()});function Ze(r){return r.subscribe(()=>{})}var Qe=O(()=>{"use strict"});var en=O(()=>{"use strict";Qe()});var Rn={};sn(Rn,{NativeIndexBackend:()=>he,NativeListBackend:()=>pe,NativeLogBackend:()=>me,NativeMapBackend:()=>be,mergeReactiveLogs:()=>En,reactiveIndex:()=>xn,reactiveList:()=>Nn,reactiveLog:()=>Mn,reactiveMap:()=>An});module.exports=dn(Rn);Y();U();se();function Je(r,e){if(r===e)return 0;let n=typeof r;if(n===typeof e&&(n==="number"||n==="string"||n==="boolean"||n==="bigint")){let o=r,i=e;return o<i?-1:o>i?1:0}return String(r).localeCompare(String(e))}function Tn(r,e){let n=Je(r[0],e[0]);return n!==0?n:Je(r[1],e[1])}function Xe(r){return[r.secondary,r.primary]}function Z(r,e){let n=Xe(e),t=0,o=r.length;for(;t<o;){let i=t+o>>1;Tn(n,Xe(r[i]))>0?t=i+1:o=i}return t}var he=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,o){let i=this._byPrimary.get(e),a={primary:e,secondary:n,value:t};if(i!==void 0&&o?.equals?.(i,a))return!1;if(i!==void 0){let d=Z(this._buf,i);this._buf.splice(d,1)}let s=Z(this._buf,a);return this._buf.splice(s,0,a),this._byPrimary.set(e,a),this._version+=1,i===void 0}upsertMany(e,n){let t=0;try{for(let o of e){let i=this._byPrimary.get(o.primary),a={primary:o.primary,secondary:o.secondary,value:o.value};if(i!==void 0&&n?.equals?.(i,a))continue;if(i!==void 0){let d=Z(this._buf,i);this._buf.splice(d,1)}let s=Z(this._buf,a);this._buf.splice(s,0,a),this._byPrimary.set(o.primary,a),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=Z(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 o=this._byPrimary.get(t);if(o===void 0)continue;let i=Z(this._buf,o);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 wn(r){return r.subscribe(()=>{})}function xn(r={}){let{name:e,versioning:n,equals:t,backend:o}=r,i=o??new he;function a(f){return f?.equals!==void 0||t===void 0?f:{...f,equals:t}}let s=L([],{name:e,describeKind:"state",equals:(f,m)=>f===m,...n!=null?{versioning:n}:{}}),d=$([s],([f])=>{let m=f,y=new Map;for(let w of m)y.set(w.primary,w.value);return y},{initial:i.toPrimaryMap(),describeKind:"derived"}),u=wn(d),c=!1;function p(){let f=i.toArray();K(()=>{s.down([[R]]),s.down([[N,f]])})}function h(f){let m=i.version;try{return f()}finally{i.version!==m&&p()}}return{ordered:s,byPrimary:d,has(f){return i.has(f)},get(f){return i.get(f)},get size(){return i.size},upsert(f,m,y,w){return h(()=>i.upsert(f,m,y,a(w)))},upsertMany(f,m){let y=[...f];y.length!==0&&h(()=>i.upsertMany(y,a(m)))},delete(f){h(()=>i.delete(f))},deleteMany(f){let m=[...f];m.length!==0&&h(()=>i.deleteMany(m))},clear(){h(()=>i.clear())},dispose(){c||(c=!0,u())}}}Y();U();se();var pe=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 Nn(r,e={}){let{name:n,versioning:t,backend:o}=e,i=o??new pe(r),a=L(i.toArray(),{name:n,describeKind:"state",equals:(u,c)=>u===c,...t!=null?{versioning:t}:{}});function s(){let u=i.toArray();K(()=>{a.down([[R]]),a.down([[N,u]])})}function d(u){let c=i.version;try{return u()}finally{i.version!==c&&s()}}return{items:a,get size(){return i.size},at(u){return i.at(u)},append(u){d(()=>i.append(u))},appendMany(u){d(()=>i.appendMany(u))},insert(u,c){d(()=>i.insert(u,c))},insertMany(u,c){d(()=>i.insertMany(u,c))},pop(u=-1){return d(()=>i.pop(u))},clear(){d(()=>i.clear())},dispose(){}}}Y();U();Re();se();en();var me=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),o=e.length-t;for(let i=0;i<t;i++)this._buf[i]=e[o+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),o=Math.min(e,this._size);if(o>=t)return[];let i=t-o;if(this._maxSize===void 0)return this._buf.slice(o,t);let a=new Array(i);for(let s=0;s<i;s++)a[s]=this._buf[(this._head+o+s)%this._maxSize];return a}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}snapshot(){return this.toArray()}restore(e){if(this._maxSize===void 0){this._buf.length=0;for(let n=0;n<e.length;n++)this._buf.push(e[n]);this._size=this._buf.length}else{let n=this._maxSize;for(let i=0;i<n;i++)this._buf[i]=void 0;this._head=0;let t=Math.min(e.length,n),o=e.length-t;for(let i=0;i<t;i++)this._buf[i]=e[o+i];this._size=t}this._version+=1}_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 ae(r){return r.subscribe(()=>{})}var kn=64;function Mn(r,e={}){let{name:n,maxSize:t,versioning:o,guard:i,backend:a}=e,s=a??new me(r,t),d=L(s.toArray(),{name:n,describeKind:"state",equals:(l,b)=>l===b,...o!=null?{versioning:o}:{},...i!=null?{guard:i}:{}});function u(){let l=s.toArray();K(()=>{d.down([[R]],{internal:!0}),d.down([[N,l]],{internal:!0})})}let c=new Map,p=new Map,h=new Map;function f(l,b){return`${l}:${b===void 0?"END":b}`}function m(l){if(l.size<kn)return;let b=l.keys().next();if(b.done)return;let v=l.get(b.value);v!==void 0&&v.dispose(),l.delete(b.value)}function y(l){let b=s.version;try{return l()}finally{s.version!==b&&u()}}function w(l){if(!Number.isInteger(l)||l<0)throw new RangeError(`tail: n must be a non-negative integer (got ${l})`);let b=c.get(l);if(b!==void 0)return c.delete(l),c.set(l,b),b.node;m(c);let v=$([d],([g])=>{let x=g;return l===0||x.length===0?[]:x.slice(Math.max(0,x.length-l))},{initial:s.tail(l),describeKind:"derived"}),T=ae(v);return c.set(l,{node:v,dispose:T}),v}function _(l,b){if(!Number.isInteger(l)||l<0)throw new RangeError(`slice: start must be a non-negative integer (got ${l})`);if(b!==void 0&&(!Number.isInteger(b)||b<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${b})`);let v=f(l,b),T=p.get(v);if(T!==void 0)return p.delete(v),p.set(v,T),T.node;m(p);let g=$([d],([A])=>{let S=A;return b===void 0?S.slice(l):S.slice(l,b)},{initial:s.slice(l,b),describeKind:"derived"}),x=ae(g);return p.set(v,{node:g,dispose:x}),g}function E(l){let b=h.get(l);if(b!==void 0)return b.node;let v=$([d,l],([g,x])=>{let A=g,S=Math.max(0,Math.trunc(x??0));return A.slice(S)},{initial:[],describeKind:"derived"}),T=ae(v);return h.set(l,{node:v,dispose:T}),v}let M,V;function C(){M===void 0&&(M=ie([d],(l,b,v)=>{let T=l[0],x=T!=null&&T.length>0?T.at(-1):v.prevData[0];if(x==null||x.length===0){b.down([[D]]);return}b.emit(x[x.length-1])},{name:n!=null?`${n}::lastValue`:"lastValue",describeKind:"derived",initial:s.size===0?void 0:s.at(s.size-1)}),V=$([d],([l])=>l.length>0,{name:n!=null?`${n}::hasLatest`:"hasLatest",describeKind:"derived",initial:s.size>0}),ae(M),ae(V))}let W={entries:d,get size(){return s.size},at(l){return s.at(l)},append(l){y(()=>s.append(l))},appendMany(l){l.length!==0&&y(()=>s.appendMany(l))},clear(){y(()=>s.clear())},trimHead(l){y(()=>s.trimHead(l))},withLatest(){return C(),d},get lastValue(){return C(),M},get hasLatest(){return C(),V},view(l){switch(l.kind){case"tail":return w(l.n);case"slice":return _(l.start,l.stop);case"fromCursor":return E(l.cursor)}},attach(l){let b=l.subscribe(v=>{for(let T of v)T[0]===N&&W.append(T[1])});return()=>b()},attachStorage(l){if(l.length===0)return()=>{};let b=new Map;for(let T of l)b.set(T,s.size);(async()=>{for(let T of l)if(typeof T.loadEntries=="function")try{let g=await Promise.resolve(T.loadEntries());g.entries.length>0&&s.size===0&&(s.restore(g.entries),b.set(T,g.entries.length),u());break}catch{}})();let v=d.subscribe(T=>{for(let g of T){if(g[0]!==N)continue;let x=g[1];for(let A of l){let S=b.get(A)??0;if(x.length<S){try{let z=A.appendEntries(x);z instanceof Promise&&z.catch(()=>{})}catch{}b.set(A,x.length);continue}if(x.length===S)continue;let Q=x.slice(S);b.set(A,x.length);try{let z=A.appendEntries(Q);z instanceof Promise&&z.catch(()=>{})}catch{}}}});return()=>v()},disposeAllViews(){for(let l of c.values())l.dispose();c.clear();for(let l of p.values())l.dispose();p.clear();for(let l of h.values())l.dispose();h.clear()},dispose(){for(let l of c.values())l.dispose();c.clear();for(let l of p.values())l.dispose();p.clear();for(let l of h.values())l.dispose();h.clear()}};return W}var Se=new WeakMap;function En(r){let e=Se.get(r);if(e)return e;let n=r.map(c=>c.cache??[]),t=n.flat(),o=L(t,{name:"mergeReactiveLogs",describeKind:"state",equals:(c,p)=>c===p}),i=r.map((c,p)=>[...n[p]??[]]),a=[];for(let c=0;c<r.length;c++){let p=c,h=r[p].subscribe(f=>{for(let m of f)if(m[0]===N)i[p]=[...m[1]],o.emit(i.flat());else if(m[0]===I){i[p]=[];let y=a[p];y!==void 0&&(a[p]=void 0,y())}else m[0]===k&&o.down([[k,m[1]]])});a.push(h)}let s=Ze(o),d=!1,u={node:o,dispose(){if(!d){d=!0;for(let c of a)c?.();a.length=0,s(),Se.delete(r)}}};return Se.set(r,u),u}Y();we();U();se();var be=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 o=this._resolveExpiresAt(t);this._store.has(e)&&this._store.delete(e),this._store.set(e,{value:n,expiresAt:o}),this._evictLruWhileOver(),this._version+=1}setMany(e,n){let t=this._resolveExpiresAt(n),o=0;try{for(let[i,a]of e)this._store.has(i)&&this._store.delete(i),this._store.set(i,{value:a,expiresAt:t}),o+=1}finally{o>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=oe(),n=0;for(let[t,o]of this._store)this._isExpired(o,e)&&(this._store.delete(t),n+=1);return n>0&&(this._version+=1),n}toMap(){let e=oe(),n=new Map;for(let[t,o]of this._store)this._isExpired(o,e)||n.set(t,o.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 oe()+n*1e9}}_isExpired(e,n){return e.expiresAt===void 0?!1:(n??oe())>=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 An(r={}){let{name:e,maxSize:n,defaultTtl:t,versioning:o,backend:i,retention:a}=r;if(a&&n!==void 0)throw new RangeError("reactiveMap: `maxSize` (LRU) and `retention` (score-based) are mutually exclusive. Pick one eviction policy.");if(a&&a.archiveThreshold===void 0&&a.maxSize===void 0)throw new RangeError("reactiveMap: `retention` requires at least one of `archiveThreshold` or `maxSize` to trigger archival.");let s=i??new be({maxSize:n,defaultTtl:t}),d=L(s.toMap(),{name:e,describeKind:"state",equals:(h,f)=>h===f,...o!=null?{versioning:o}:{}});function u(){let h=s.toMap();K(()=>{d.down([[R]]),d.down([[N,h]])})}function c(){if(!a)return;let h=s.toMap(),f=a.archiveThreshold,m=a.maxSize,y=[];for(let[_,E]of h)y.push({key:_,value:E,score:a.score(_,E)});y.sort((_,E)=>_.score-E.score);let w=new Set;if(f!==void 0)for(let _ of y)if(_.score<f)w.add(_.key);else break;if(m!==void 0&&y.length-w.size>m)for(let _ of y){if(y.length-w.size<=m)break;w.has(_.key)||w.add(_.key)}if(w.size!==0)for(let _ of y)w.has(_.key)&&(a.onArchive?.(_.key,_.value,_.score),s.delete(_.key))}function p(h,f="mutation"){let m=s.version;try{return h()}finally{s.version!==m&&(f==="mutation"&&c(),u())}}return{entries:d,has(h){return p(()=>s.has(h),"read")},get(h){return p(()=>s.get(h),"read")},set(h,f,m){p(()=>s.set(h,f,m?.ttl))},setMany(h,f){p(()=>s.setMany(h,f?.ttl))},delete(h){p(()=>s.delete(h))},deleteMany(h){p(()=>s.deleteMany(h))},clear(){p(()=>s.clear())},pruneExpired(){p(()=>s.pruneExpired())},get size(){return s.size},dispose(){}}}0&&(module.exports={NativeIndexBackend,NativeListBackend,NativeLogBackend,NativeMapBackend,mergeReactiveLogs,reactiveIndex,reactiveList,reactiveLog,reactiveMap});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { N as Node, V as VersioningLevel } from '../node-
|
|
2
|
-
export { L as LogBackend, M as MergedReactiveLog, N as NativeLogBackend, a as ReactiveLogBundle, R as ReactiveLogOptions, V as ViewSpec, m as mergeReactiveLogs, r as reactiveLog } from '../reactive-log-
|
|
3
|
-
export { M as MapBackend, N as NativeMapBackend, a as NativeMapBackendOptions, R as ReactiveMapBundle, b as ReactiveMapOptions, c as ReactiveMapRetention, r as reactiveMap } from '../reactive-map-
|
|
1
|
+
import { N as Node, V as VersioningLevel } from '../node-kK3CvTrR.cjs';
|
|
2
|
+
export { L as LogBackend, M as MergedReactiveLog, N as NativeLogBackend, a as ReactiveLogBundle, R as ReactiveLogOptions, V as ViewSpec, m as mergeReactiveLogs, r as reactiveLog } from '../reactive-log-DIGdYqQ6.cjs';
|
|
3
|
+
export { M as MapBackend, N as NativeMapBackend, a as NativeMapBackendOptions, R as ReactiveMapBundle, b as ReactiveMapOptions, c as ReactiveMapRetention, r as reactiveMap } from '../reactive-map-CEFGp8TK.cjs';
|
|
4
4
|
import './storage-tiers.cjs';
|
|
5
5
|
|
|
6
6
|
type IndexRow<K, V = unknown> = {
|
package/dist/extra/reactive.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { N as Node, V as VersioningLevel } from '../node-
|
|
2
|
-
export { L as LogBackend, M as MergedReactiveLog, N as NativeLogBackend, a as ReactiveLogBundle, R as ReactiveLogOptions, V as ViewSpec, m as mergeReactiveLogs, r as reactiveLog } from '../reactive-log-
|
|
3
|
-
export { M as MapBackend, N as NativeMapBackend, a as NativeMapBackendOptions, R as ReactiveMapBundle, b as ReactiveMapOptions, c as ReactiveMapRetention, r as reactiveMap } from '../reactive-map-
|
|
1
|
+
import { N as Node, V as VersioningLevel } from '../node-kK3CvTrR.js';
|
|
2
|
+
export { L as LogBackend, M as MergedReactiveLog, N as NativeLogBackend, a as ReactiveLogBundle, R as ReactiveLogOptions, V as ViewSpec, m as mergeReactiveLogs, r as reactiveLog } from '../reactive-log-BKALbfal.js';
|
|
3
|
+
export { M as MapBackend, N as NativeMapBackend, a as NativeMapBackendOptions, R as ReactiveMapBundle, b as ReactiveMapOptions, c as ReactiveMapRetention, r as reactiveMap } from '../reactive-map-DS_SIAxv.js';
|
|
4
4
|
import './storage-tiers.js';
|
|
5
5
|
|
|
6
6
|
type IndexRow<K, V = unknown> = {
|
package/dist/extra/reactive.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as p,b as t}from"../chunk-
|
|
1
|
+
import{a as p,b as t}from"../chunk-A5WCQ5NO.js";import{a as x,b as a}from"../chunk-GLERH466.js";import{a as f,b as m}from"../chunk-BEZWM2SY.js";import{a as o,b as r,c as e}from"../chunk-YBB7ZGTY.js";import"../chunk-CRVT7D2P.js";import"../chunk-NTEURFZH.js";import"../chunk-CK2E7BTU.js";import"../chunk-QYADASLV.js";export{p as NativeIndexBackend,x as NativeListBackend,o as NativeLogBackend,f as NativeMapBackend,e as mergeReactiveLogs,t as reactiveIndex,a as reactiveList,r as reactiveLog,m as reactiveMap};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { b as GraphDescribeOutput } from '../../graph-
|
|
2
|
-
import '../../node-
|
|
3
|
-
import '../../
|
|
1
|
+
import { b as GraphDescribeOutput } from '../../graph-CWvEUQAq.cjs';
|
|
2
|
+
import '../../node-kK3CvTrR.cjs';
|
|
3
|
+
import '../../sugar-DQjFmVqb.cjs';
|
|
4
4
|
import '../storage-core.cjs';
|
|
5
5
|
import '../storage-tiers.cjs';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { b as GraphDescribeOutput } from '../../graph-
|
|
2
|
-
import '../../node-
|
|
3
|
-
import '../../
|
|
1
|
+
import { b as GraphDescribeOutput } from '../../graph-D9LFnda9.js';
|
|
2
|
+
import '../../node-kK3CvTrR.js';
|
|
3
|
+
import '../../sugar-fhLIE7TT.js';
|
|
4
4
|
import '../storage-core.js';
|
|
5
5
|
import '../storage-tiers.js';
|
|
6
6
|
|