@graphrefly/graphrefly 0.41.0 → 0.43.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-Cxs1eztH.d.cts → cascading-CH-_VwG9.d.cts} +2 -2
- package/dist/{cascading-BNfxffgc.d.ts → cascading-OgKQZjsa.d.ts} +2 -2
- package/dist/chunk-3XDYJRYU.js +1 -0
- package/dist/{chunk-AI7QC7J6.js → chunk-4YAN45KM.js} +1 -1
- package/dist/chunk-626TESAC.js +3 -0
- package/dist/chunk-6HOSXQKF.js +1 -0
- package/dist/{chunk-G3M3IMEV.js → chunk-CUNIRONA.js} +1 -1
- package/dist/chunk-EBW4V6JN.js +1 -0
- package/dist/chunk-FDQGFWLF.js +1 -0
- package/dist/{chunk-33N4TU3X.js → chunk-FG4TKHMC.js} +1 -1
- package/dist/{chunk-YQRN4CIV.js → chunk-I7IGYPSL.js} +1 -1
- package/dist/chunk-INQD2KRQ.js +1 -0
- package/dist/{chunk-7PQLZMOG.js → chunk-JNWRYDJN.js} +1 -1
- package/dist/{chunk-TT4C7DXW.js → chunk-JQFH2DV6.js} +1 -1
- package/dist/{chunk-M3FQSXEW.js → chunk-K2Q24F5T.js} +1 -1
- package/dist/chunk-KVV66NN2.js +1 -0
- package/dist/chunk-NON4NLIC.js +45 -0
- package/dist/{chunk-CYOSWFT2.js → chunk-O2BLLH7M.js} +3 -3
- package/dist/{chunk-OV5AA6HJ.js → chunk-OCKEEPRJ.js} +1 -1
- package/dist/{chunk-X7QKTXXC.js → chunk-OFZG3TB3.js} +3 -3
- package/dist/chunk-OYJKFY7V.js +1 -0
- package/dist/{chunk-SC27WTSG.js → chunk-P6C4WHZO.js} +1 -1
- package/dist/{chunk-VV62MIG4.js → chunk-PT7W5FCD.js} +1 -1
- package/dist/{chunk-UISPDFJ3.js → chunk-Q4U3A3L5.js} +1 -1
- package/dist/chunk-QE4IGY7I.js +61 -0
- package/dist/{chunk-5VEZLQFN.js → chunk-QYVXF7GW.js} +1 -1
- package/dist/{chunk-ZAJ7J7TO.js → chunk-S3EEIPO7.js} +1 -1
- package/dist/{chunk-GI4Q7PNY.js → chunk-SUWT3ZON.js} +1 -1
- package/dist/{chunk-CGNOWGV6.js → chunk-TPKQW72B.js} +1 -1
- package/dist/{chunk-L77I47VU.js → chunk-V5A7M7RJ.js} +1 -1
- package/dist/chunk-VNC3TMVY.js +1 -0
- package/dist/{chunk-AK5RHMC5.js → chunk-VOPGGIL7.js} +1 -1
- package/dist/chunk-VQ4A6T2A.js +1 -0
- package/dist/{chunk-KNVCCBIU.js → chunk-XG62INFA.js} +1 -1
- package/dist/{chunk-F7VUYPP6.js → chunk-Y4NI3X7O.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.d.cts +2 -2
- package/dist/compat/jotai/index.d.ts +2 -2
- package/dist/compat/nanostores/index.d.cts +2 -2
- package/dist/compat/nanostores/index.d.ts +2 -2
- 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.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/{decay-C25AyNAj.d.cts → decay-2ZukgQ4o.d.cts} +2 -2
- package/dist/{decay-BnrlbxSv.d.ts → decay-CdEBmDIs.d.ts} +2 -2
- package/dist/extra/browser.d.cts +1 -1
- package/dist/extra/browser.d.ts +1 -1
- package/dist/extra/index.cjs +14 -14
- package/dist/extra/index.d.cts +10 -11
- package/dist/extra/index.d.ts +10 -11
- 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 +1 -1
- package/dist/extra/operators.d.ts +1 -1
- package/dist/extra/operators.js +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 -1
- 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.d.cts +1 -1
- package/dist/extra/storage-browser.d.ts +1 -1
- package/dist/{fallback-CMZl39L5.d.ts → fallback-CqYVLL6X.d.ts} +1 -1
- package/dist/{fallback-8JYU8tlT.d.cts → fallback-Ctlj2tMY.d.cts} +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-BkIkog4h.d.ts → graph-7VguS7a4.d.ts} +3 -3
- package/dist/{graph-E6likq7w.d.cts → graph-C4SHb3Ly.d.cts} +3 -3
- package/dist/{index-DgJc8Zgc.d.cts → index-0rKFCVFp.d.cts} +90 -5
- package/dist/{index-BAQrjuZF.d.ts → index-B-i4_g3k.d.ts} +2 -2
- package/dist/{index-DpiGqtrs.d.cts → index-B5iz82A3.d.cts} +441 -381
- package/dist/{index-Bd91Nmf4.d.cts → index-BAOD98JD.d.cts} +4 -4
- package/dist/{index-2n8Eai6M.d.ts → index-BG0BN3PB.d.ts} +1 -1
- package/dist/{index-z8WFPVI8.d.cts → index-BJX94aud.d.cts} +1 -1
- package/dist/{index-DhLyOHYZ.d.ts → index-BP8a88zx.d.ts} +11 -4
- package/dist/{index-Cnr1WrlX.d.cts → index-BTQtTb_H.d.cts} +14 -3
- package/dist/{index-DOBLxOti.d.cts → index-BVpm6noz.d.cts} +1 -1
- package/dist/{index-Cczxgd2D.d.ts → index-Bc41FuHp.d.cts} +3 -3
- package/dist/{index-BiHUBEKq.d.cts → index-BdGtBX-X.d.cts} +3 -3
- package/dist/{index-da2V5vPy.d.ts → index-Bf7eqeSF.d.ts} +2 -2
- package/dist/{index-DuRsN9ae.d.cts → index-BiX1Nkgx.d.cts} +383 -18
- package/dist/{index-DGTo1yka.d.cts → index-BoLv_OfD.d.cts} +2 -2
- package/dist/{index-DVAlsmEU.d.cts → index-BojK2fwH.d.cts} +3 -3
- package/dist/{index-B72TQQHd.d.cts → index-BsT7F2et.d.ts} +3 -3
- package/dist/{index-DGD4_fj6.d.cts → index-BwLvVVsy.d.cts} +8 -5
- package/dist/{index-CQtWm7jS.d.ts → index-C59mYFKp.d.ts} +9 -9
- package/dist/{index-C6ZUaos7.d.ts → index-C7O6r5fV.d.ts} +1 -1
- package/dist/{index-CL7oilfm.d.cts → index-C9kSENB4.d.cts} +1 -1
- package/dist/{index-DVDapw2k.d.cts → index-C9pjcz3l.d.cts} +35 -36
- package/dist/{index-CG33HeBW.d.ts → index-CAC_rNzm.d.ts} +8 -5
- package/dist/{index-yLt-aPMp.d.ts → index-CCq87F7t.d.ts} +1 -1
- package/dist/{index-D4uimgee.d.cts → index-CDXc9zKM.d.cts} +1 -1
- package/dist/{index-B2RUoIUz.d.ts → index-CJK1JkYy.d.ts} +1 -1
- package/dist/{index-DktLSZOc.d.cts → index-CLon-IWF.d.cts} +4 -4
- package/dist/{index-DQQCOIt8.d.cts → index-COD1kVoS.d.cts} +10 -5
- package/dist/{index-bXXLSvor.d.ts → index-CPT7C_f1.d.ts} +4 -4
- package/dist/{index-CD2dBMet.d.ts → index-CQG3D1cp.d.ts} +10 -5
- package/dist/{index-BQ1fR4li.d.ts → index-CZQXo5tH.d.ts} +35 -36
- package/dist/{index-A3U3CSve.d.cts → index-CZjOhcBy.d.cts} +2 -2
- package/dist/{index-DYTBbF8T.d.cts → index-ChOyVLKm.d.cts} +1 -1
- package/dist/{index-BJSZxSFX.d.ts → index-CvrqGfNS.d.ts} +1 -1
- package/dist/{index-DhnsQfa3.d.ts → index-D-AEQVLo.d.ts} +441 -381
- package/dist/{index-CAP3UGsq.d.ts → index-D4Y1cMG0.d.ts} +1 -1
- package/dist/{index-40ZT4MHj.d.ts → index-DBHK8O6H.d.ts} +14 -3
- package/dist/{index-3k4Gg6-n.d.ts → index-DBevwHj_.d.ts} +3 -3
- package/dist/{index-Ctb7_2sG.d.ts → index-DIOoAZUX.d.ts} +1 -1
- package/dist/{index-WSlcjhQF.d.ts → index-DSZ3ZCHF.d.ts} +124 -13
- package/dist/{index-DH4fm2Ck.d.ts → index-Dgs8zcj7.d.ts} +2 -2
- package/dist/{index-BaA-xpSw.d.ts → index-Dh_HJ82K.d.ts} +3 -3
- package/dist/{index-CtFNGe-m.d.cts → index-Dhc7a7Xo.d.cts} +2 -2
- package/dist/{index-CoM4rzyB.d.ts → index-Dmqp7KjD.d.ts} +1 -1
- package/dist/{index-B6iTqKtJ.d.ts → index-Dn-wI9g4.d.ts} +2 -2
- package/dist/{index-C-dkXOpB.d.cts → index-Du7u1lSf.d.cts} +11 -4
- package/dist/{index-DfOK_oL5.d.ts → index-DwigL4lY.d.ts} +383 -18
- package/dist/index-DyR7eU5S.d.cts +779 -0
- package/dist/index-JZUPJIJy.d.ts +779 -0
- package/dist/{index-I1cCY3ZI.d.ts → index-K0_0eR8g.d.ts} +90 -5
- package/dist/{index-BilOa6AE.d.cts → index-O16yXPK4.d.cts} +124 -13
- package/dist/{index-CRm0YIzC.d.cts → index-O7fucFrU.d.cts} +9 -9
- package/dist/{index-MxYuWOrf.d.cts → index-RV_yDjOX.d.cts} +3 -3
- package/dist/{index-C5cQ7Gfx.d.ts → index-cm1GNcWE.d.ts} +4 -4
- package/dist/{index-CgnCFhr2.d.cts → index-f5IivDUX.d.cts} +1 -1
- package/dist/{index-PgwvGWa1.d.cts → index-hHcaFlJX.d.cts} +1 -1
- package/dist/{index-tV3AA9hI.d.cts → index-tJoTcnHh.d.cts} +2 -2
- package/dist/{index-eaQuGJnv.d.ts → index-wAzD9yVj.d.ts} +3 -3
- package/dist/{index-D3ayz3hy.d.cts → index-z96luz5O.d.cts} +1 -1
- package/dist/index.cjs +48 -48
- package/dist/index.d.cts +45 -50
- package/dist/index.d.ts +45 -50
- package/dist/index.js +1 -1
- package/dist/{meta-D8OyedKp.d.ts → meta-BgVAsg9j.d.ts} +1 -1
- package/dist/{meta-Ct9nqQS5.d.cts → meta-vE8bxW1E.d.cts} +1 -1
- package/dist/{node-BYInONRr.d.cts → node-ClS5yC-B.d.cts} +1 -1
- package/dist/{node-BYInONRr.d.ts → node-ClS5yC-B.d.ts} +1 -1
- package/dist/{observable-DO8DDEzv.d.ts → observable-BsBzUrcI.d.ts} +1 -1
- package/dist/{observable-DMIlYJV1.d.cts → observable-DLGPPtb8.d.cts} +1 -1
- 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 +17 -17
- package/dist/patterns/ai/index.d.cts +17 -17
- package/dist/patterns/ai/index.d.ts +17 -17
- package/dist/patterns/ai/index.js +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 +12 -12
- 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 +10 -8
- package/dist/patterns/harness/index.d.cts +11 -12
- package/dist/patterns/harness/index.d.ts +11 -12
- package/dist/patterns/harness/index.js +1 -1
- package/dist/patterns/inspect/index.cjs +3 -0
- package/dist/patterns/inspect/index.d.cts +9 -0
- package/dist/patterns/inspect/index.d.ts +9 -0
- package/dist/patterns/inspect/index.js +1 -0
- 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 +7 -7
- package/dist/patterns/orchestration/index.d.ts +7 -7
- package/dist/patterns/orchestration/index.js +1 -1
- package/dist/patterns/process/index.cjs +1 -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 +8 -8
- 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-MWrQZXCq.d.cts → pipeline-graph-DPqKDk59.d.cts} +5 -5
- package/dist/{pipeline-graph-CB4La-UW.d.ts → pipeline-graph-loP57TBA.d.ts} +5 -5
- package/dist/{reactive-layout-BtZfUKuL.d.cts → reactive-layout-Dsvob4zD.d.cts} +2 -2
- package/dist/{reactive-layout-KJj4E2dT.d.ts → reactive-layout-v7KPvxoc.d.ts} +2 -2
- package/dist/{reactive-log-_zeEnB9H.d.cts → reactive-log-B00laMSQ.d.cts} +1 -1
- package/dist/{reactive-log-BlAsPLl2.d.ts → reactive-log-BezYsbA_.d.ts} +1 -1
- package/dist/{reactive-map-6P_k3AQM.d.cts → reactive-map-48mnZ-nu.d.cts} +1 -1
- package/dist/{reactive-map-CjXByDV-.d.ts → reactive-map-BVVPdvmi.d.ts} +1 -1
- package/dist/resilience-YIWPK4YC.js +1 -0
- package/dist/{sugar-DzePN5-g.d.cts → sugar-DLwvMr3F.d.ts} +24 -4
- package/dist/{sugar-BhfjgetH.d.ts → sugar-DyVGtczU.d.cts} +24 -4
- package/dist/{topology-tree-mF7Emqzm.d.ts → topology-tree-BNGvuG82.d.ts} +1 -1
- package/dist/{topology-tree-3LBKFsUo.d.cts → topology-tree-BSdfSwMi.d.cts} +1 -1
- package/dist/{types-1Dhoi7HM.d.cts → types-B1jDWVsM.d.cts} +1 -1
- package/dist/{types-39jk0kaV.d.ts → types-DkzUUs0H.d.ts} +1 -1
- package/package.json +11 -51
- package/dist/budget-gate-CmmVtasH.d.ts +0 -115
- package/dist/budget-gate-DiP_nK0n.d.cts +0 -115
- package/dist/chunk-2W553JJC.js +0 -1
- package/dist/chunk-4MKL6Q3K.js +0 -1
- package/dist/chunk-5B3JDG5F.js +0 -1
- package/dist/chunk-5QSXEMXG.js +0 -1
- package/dist/chunk-5TEFC2ZX.js +0 -1
- package/dist/chunk-5TOPVRN6.js +0 -1
- package/dist/chunk-EC2WNSZ7.js +0 -1
- package/dist/chunk-ELAASRBT.js +0 -3
- package/dist/chunk-H5SCWHWP.js +0 -1
- package/dist/chunk-OLIKJUKI.js +0 -1
- package/dist/chunk-POXANAJ6.js +0 -3
- package/dist/chunk-RSMEXK53.js +0 -43
- package/dist/chunk-SGS4OJGS.js +0 -1
- package/dist/chunk-URJ2VFNC.js +0 -1
- package/dist/chunk-VXPLLA4P.js +0 -1
- package/dist/chunk-WZYB3JQS.js +0 -1
- package/dist/chunk-Z6X7B6A4.js +0 -61
- package/dist/index-8s-Qm-gz.d.ts +0 -218
- package/dist/index-BgjS2b8N.d.ts +0 -366
- package/dist/index-BmSQLAZo.d.cts +0 -244
- package/dist/index-CGhMJNHb.d.cts +0 -128
- package/dist/index-CUIkE1l9.d.cts +0 -230
- package/dist/index-Ck35nA-T.d.ts +0 -244
- package/dist/index-CuPUehFa.d.cts +0 -218
- package/dist/index-D1Gc7wV5.d.ts +0 -230
- package/dist/index-N2MAxt7_.d.ts +0 -128
- package/dist/index-t6L2qpHh.d.cts +0 -366
- package/dist/patterns/audit/index.cjs +0 -3
- package/dist/patterns/audit/index.d.cts +0 -8
- package/dist/patterns/audit/index.d.ts +0 -8
- package/dist/patterns/audit/index.js +0 -1
- package/dist/patterns/guarded-execution/index.cjs +0 -3
- package/dist/patterns/guarded-execution/index.d.cts +0 -9
- package/dist/patterns/guarded-execution/index.d.ts +0 -9
- package/dist/patterns/guarded-execution/index.js +0 -1
- package/dist/patterns/lens/index.cjs +0 -3
- package/dist/patterns/lens/index.d.cts +0 -7
- package/dist/patterns/lens/index.d.ts +0 -7
- package/dist/patterns/lens/index.js +0 -1
- package/dist/patterns/refine-loop/index.cjs +0 -5
- package/dist/patterns/refine-loop/index.d.cts +0 -9
- package/dist/patterns/refine-loop/index.d.ts +0 -9
- package/dist/patterns/refine-loop/index.js +0 -1
- package/dist/patterns/resilient-pipeline/index.cjs +0 -3
- package/dist/patterns/resilient-pipeline/index.d.cts +0 -8
- package/dist/patterns/resilient-pipeline/index.d.ts +0 -8
- package/dist/patterns/resilient-pipeline/index.js +0 -1
- package/dist/resilience-JISHQD2F.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O,b as H,c as j,d as E,e as W,f as ne}from"./chunk-
|
|
1
|
+
import{a as O,b as H,c as j,d as E,e as W,f as ne}from"./chunk-OCKEEPRJ.js";import{a as N}from"./chunk-D27JNOLZ.js";import{a as X}from"./chunk-C72GO4IZ.js";import{j as T}from"./chunk-626TESAC.js";import{D as I,E as y,G as L,o as S}from"./chunk-LYCLF26R.js";import{b as te}from"./chunk-QYADASLV.js";var ie={};te(ie,{CanvasMeasureAdapter:()=>$,CliMeasureAdapter:()=>D,ImageSizeAdapter:()=>J,NodeCanvasMeasureAdapter:()=>q,PrecomputedAdapter:()=>V,SvgBoundsAdapter:()=>z,analyzeAndMeasure:()=>O,carveTextLineSlots:()=>E,circleIntervalForBand:()=>Q,computeBlockFlow:()=>_,computeCharPositions:()=>W,computeFlowLines:()=>ee,computeLineBreaks:()=>H,computeTotalHeight:()=>U,layoutNextLine:()=>j,measureBlock:()=>Y,measureBlocks:()=>K,reactiveBlockLayout:()=>re,reactiveFlowLayout:()=>se,reactiveLayout:()=>ne,rectIntervalForBand:()=>Z});var D=class{cellPx;constructor(t){this.cellPx=t?.cellPx??8}measureSegment(t,n){return{width:X(t)*this.cellPx}}},G=class extends Error{name="KeyError"},V=class{metrics;fallback;constructor(t){this.metrics=t.metrics;let n=t.fallback??"per-char";if(n!=="per-char"&&n!=="error")throw new Error(`fallback must be 'per-char' or 'error', got ${JSON.stringify(t.fallback)}`);this.fallback=n}measureSegment(t,n){let i=this.metrics[n];if(i){let o=i[t];if(o!==void 0)return{width:o}}if(this.fallback==="error")throw new G(`PrecomputedAdapter: no metrics for segment ${JSON.stringify(t)} in font ${JSON.stringify(n)}`);let r=0;if(i)for(let o of t){let l=i[o];l!==void 0&&(r+=l)}return{width:r}}},$=class{ctx=null;currentFont="";emojiCorrection;constructor(t){this.emojiCorrection=t?.emojiCorrection??1}getContext(){if(!this.ctx){if(typeof OffscreenCanvas>"u")throw new Error("CanvasMeasureAdapter requires a browser environment with OffscreenCanvas support. Use CliMeasureAdapter or NodeCanvasMeasureAdapter for Node.js.");let n=new OffscreenCanvas(0,0).getContext("2d");if(!n)throw new Error("CanvasMeasureAdapter: failed to get 2d context");this.ctx=n}return this.ctx}measureSegment(t,n){let i=this.getContext();n!==this.currentFont&&(i.font=n,this.currentFont=n);let r=i.measureText(t).width;return this.emojiCorrection!==1&&new RegExp("\\p{Emoji_Presentation}","u").test(t)&&(r*=this.emojiCorrection),{width:r}}clearCache(){this.currentFont=""}},q=class{ctx=null;currentFont="";canvasModule;constructor(t){this.canvasModule=t}getContext(){if(!this.ctx){let n=this.canvasModule.createCanvas(0,0).getContext("2d");if(!n)throw new Error("NodeCanvasMeasureAdapter: failed to get 2d context");this.ctx=n}return this.ctx}measureSegment(t,n){let i=this.getContext();return n!==this.currentFont&&(i.font=n,this.currentFont=n),{width:i.measureText(t).width}}clearCache(){this.currentFont=""}},z=class{measureSvg(t){let n=t.match(/viewBox\s*=\s*["']([^"']+)["']/);if(n){let o=n[1].trim().split(/[\s,]+/);if(o.length>=4){let l=Number.parseFloat(o[2]),a=Number.parseFloat(o[3]);if(Number.isFinite(l)&&Number.isFinite(a)&&l>0&&a>0)return{width:l,height:a};throw new Error("SvgBoundsAdapter: viewBox width/height are missing, non-finite, or not positive")}}let i=t.match(/<svg[^>]*\bwidth\s*=\s*["']?([\d.]+)/),r=t.match(/<svg[^>]*\bheight\s*=\s*["']?([\d.]+)/);if(i&&r){let o=Number.parseFloat(i[1]),l=Number.parseFloat(r[1]);if(Number.isFinite(o)&&Number.isFinite(l)&&o>0&&l>0)return{width:o,height:l};throw new Error("SvgBoundsAdapter: svg width/height attributes are non-finite or not positive")}throw new Error("SvgBoundsAdapter: cannot determine dimensions \u2014 SVG has no viewBox or width/height attributes")}},J=class{sizes;constructor(t){this.sizes=new Map(Object.entries(t))}measureImage(t){let n=this.sizes.get(t);if(!n)throw new Error(`ImageSizeAdapter: no dimensions registered for ${JSON.stringify(t)}`);return{width:n.width,height:n.height}}};function Y(e,t,n,i,r,o,l){switch(e.type){case"text":{let a=e.font??r,m=e.lineHeight??o,d=O(e.text,a,n.text,i),w=H(d,t,n.text,a,i),v=W(w,d,m),B=w.lineCount*m,c=0;for(let x of w.lines)x.width>c&&(c=x.width);return{index:l,type:"text",width:Math.min(c,t),height:B,textSegments:d,textLineBreaks:w,textCharPositions:v}}case"image":{let a,m;if(e.naturalWidth!=null&&e.naturalHeight!=null)a=e.naturalWidth,m=e.naturalHeight;else if(n.image){let d=n.image.measureImage(e.src);a=d.width,m=d.height}else throw new Error(`Image block at index ${l} has no naturalWidth/naturalHeight and no ImageMeasurer adapter`);return a>t&&(m=m*t/a,a=t),{index:l,type:"image",width:a,height:m}}case"svg":{let a,m;if(e.viewBox)a=e.viewBox.width,m=e.viewBox.height;else if(n.svg){let d=n.svg.measureSvg(e.content);a=d.width,m=d.height}else throw new Error(`SVG block at index ${l} has no viewBox and no SvgMeasurer adapter`);return a>t&&(m=m*t/a,a=t),{index:l,type:"svg",width:a,height:m}}}}function K(e,t,n,i,r,o){return e.map((l,a)=>Y(l,t,n,i,r,o,a))}function _(e,t){let n=[],i=0;for(let r=0;r<e.length;r++){let o=e[r];n.push({...o,x:0,y:i}),i+=o.height+(r<e.length-1?t:0)}return n}function U(e){if(e.length===0)return 0;let t=e[e.length-1];return t.y+t.height}function re(e){let{adapters:t,name:n="reactive-block-layout",defaultFont:i="16px sans-serif",defaultLineHeight:r=20}=e,o=new T(n),l=new Map,a=y(e.blocks??[],{name:"blocks"}),m=y(Math.max(0,e.maxWidth??800),{name:"max-width"}),d=y(e.gap??0,{name:"gap"}),w=I([a,m],(c,x,s)=>{let p=c[0]!=null&&c[0].length>0?c[0].at(-1):s.prevData[0],h=c[1]!=null&&c[1].length>0?c[1].at(-1):s.prevData[1],g=S(),u=K(p,h,t,l,i,r),f=S()-g,b=w.meta;b&&(N(b["block-count"],u.length),N(b["layout-time-ns"],f)),x.emit(u);let C=()=>{l.clear(),t.text.clearCache?.()};return{deactivate:C,invalidate:C}},{name:"measured-blocks",describeKind:"derived",meta:{"block-count":0,"layout-time-ns":0},equals:(c,x)=>{let s=c,p=x;if(s==null||p==null)return s===p;if(s.length!==p.length)return!1;for(let h=0;h<s.length;h++){let g=s[h],u=p[h];if(g.type!==u.type||g.width!==u.width||g.height!==u.height||g.index!==u.index)return!1}return!0}}),v=L([w,d],([c,x])=>_(c,x),{name:"block-flow",equals:(c,x)=>{let s=c,p=x;if(s==null||p==null)return s===p;if(s.length!==p.length)return!1;for(let h=0;h<s.length;h++){let g=s[h],u=p[h];if(g.x!==u.x||g.y!==u.y||g.width!==u.width||g.height!==u.height)return!1}return!0}}),B=L([v],([c])=>U(c),{name:"total-height"});return o.add(a,{name:"blocks"}),o.add(m,{name:"max-width"}),o.add(d,{name:"gap"}),o.add(w,{name:"measured-blocks"}),o.add(v,{name:"block-flow"}),o.add(B,{name:"total-height"}),{graph:o,setBlocks:c=>o.set("blocks",c),setMaxWidth:c=>o.set("max-width",Math.max(0,c)),setGap:c=>o.set("gap",c),measuredBlocks:w,blockFlow:v,totalHeight:B}}function Q(e,t,n){let i=e.hPad??0,r=e.vPad??0,o=t-r,l=n+r;if(o>=e.cy+e.r||l<=e.cy-e.r)return null;let a=e.cy>=o&&e.cy<=l?0:e.cy<o?o-e.cy:e.cy-l;if(a>=e.r)return null;let m=Math.sqrt(e.r*e.r-a*a);return{left:e.cx-m-i,right:e.cx+m+i}}function Z(e,t,n){let i=e.hPad??0,r=e.vPad??0;return n<=e.y-r||t>=e.y+e.h+r?null:{left:e.x-i,right:e.x+e.w+i}}function oe(e,t,n){return e.kind==="circle"?Q(e,t,n):Z(e,t,n)}function ee(e,t,n,i,r,o,l){let a=l?.paragraphSpacing??r,m=[],d={segmentIndex:0,graphemeIndex:0};if(e.length===0||n.count<=0||r<=0)return{lines:m,cursor:d};let w=t.paddingX??0,v=t.paddingY??0,B=Math.max(0,t.width-w*2),c=Math.max(0,t.height-v*2),x=n.gap*Math.max(0,n.count-1),s=Math.max(0,(B-x)/n.count);if(s<=0)return{lines:m,cursor:d};e:for(let p=0;p<n.count;p++){let h=w+p*(s+n.gap),g=h+s,u=v;for(;u+r<=v+c;){let f=u+r,b=[];for(let k=0;k<i.length;k++){let M=oe(i[k],u,f);M!==null&&b.push(M)}let C=E({left:h,right:g},b,o);if(C.length===0){u+=r;continue}let P=!1;for(let k=0;k<C.length;k++){let M=C[k],R=M.right-M.left,F=j(e,d,R);if(F===null)return{lines:m,cursor:d};if(F.text.length===0&&F.width===0){d=F.end,P=!0;break}m.push({x:M.left,y:u,width:F.width,slotWidth:R,text:F.text,columnIndex:p,flushToRight:M.right<g-.5}),d=F.end}if(P){u+=a;continue}if(u+=r,d.segmentIndex>=e.length)break e}if(d.segmentIndex>=e.length)break}return{lines:m,cursor:d}}function se(e){let{adapter:t,name:n="reactive-flow-layout",minSlotWidth:i=20}=e,r=new T(n),o=new Map,l=y(e.text??"",{name:"text"}),a=y(e.font??"16px sans-serif",{name:"font"}),m=y(e.lineHeight??20,{name:"line-height"}),d=y(e.container??{width:800,height:600,paddingX:0,paddingY:0},{name:"container"}),w=y(e.columns??{count:1,gap:0},{name:"columns"}),v=y(e.obstacles??[],{name:"obstacles"}),B=y(e.paragraphSpacing??null,{name:"paragraph-spacing"}),c=I([l,a],(s,p,h)=>{let g=s[0],u=g!=null&&g.length>0?g.at(-1):h.prevData[0],f=s[1],b=f!=null&&f.length>0?f.at(-1):h.prevData[1],C=O(u,b,t,o);p.emit(C);let P=()=>{o.clear(),t.clearCache?.()};return{deactivate:P,invalidate:P}},{name:"segments",describeKind:"derived"}),x=L([c,d,w,v,m,B],([s,p,h,g,u,f])=>{let b=s,C=S(),P=f??u,{lines:k,cursor:M}=ee(b,p,h,g,u,i,{paragraphSpacing:P}),R=S()-C,F=Math.max(0,b.length-M.segmentIndex),A=x.meta;return A&&(N(A["line-count"],k.length),N(A["layout-time-ns"],R),N(A["overflow-segments"],F)),k},{name:"flow-lines",meta:{"line-count":0,"layout-time-ns":0,"overflow-segments":0},equals:(s,p)=>{let h=s,g=p;if(h.length!==g.length)return!1;for(let u=0;u<h.length;u++){let f=h[u],b=g[u];if(f.x!==b.x||f.y!==b.y||f.width!==b.width||f.slotWidth!==b.slotWidth||f.text!==b.text||f.columnIndex!==b.columnIndex||f.flushToRight!==b.flushToRight)return!1}return!0}});return r.add(l,{name:"text"}),r.add(a,{name:"font"}),r.add(m,{name:"line-height"}),r.add(d,{name:"container"}),r.add(w,{name:"columns"}),r.add(v,{name:"obstacles"}),r.add(B,{name:"paragraph-spacing"}),r.add(c,{name:"segments"}),r.add(x,{name:"flow-lines"}),{graph:r,setText:s=>r.set("text",s),setFont:s=>r.set("font",s),setLineHeight:s=>r.set("line-height",s),setContainer:s=>r.set("container",s),setColumns:s=>r.set("columns",s),setObstacles:s=>r.set("obstacles",s),setParagraphSpacing:s=>r.set("paragraph-spacing",s),segments:c,flowLines:x}}export{D as a,V as b,$ as c,q as d,z as e,J as f,Y as g,K as h,_ as i,U as j,re as k,Q as l,Z as m,ee as n,se as o,ie as p};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as dr,b as fr}from"./chunk-WZYB3JQS.js";import{b as pe}from"./chunk-TSOYJ743.js";import{$ as sr,A as It,B as Lt,C as Ct,D as jt,E as Vt,F as Pt,G as At,H as zt,I as Kt,J as Dt,K as Ut,L as _t,M as $t,N as Ft,O as Ht,P as Gt,Q as qt,R as Jt,S as Qt,T as Xt,U as Yt,V as Zt,W as er,X as nr,Y as tr,Z as rr,_ as or,a as bn,aa as ir,b as yn,ba as mr,c as ct,d as dt,e as ft,f as ut,g as pt,h as lt,i as mt,j as gt,k as bt,l as yt,m as kt,n as ht,o as vt,p as xt,q as Tt,r as wt,s as Et,t as Nt,u as Mt,v as St,w as Rt,x as Bt,y as Ot,z as Wt}from"./chunk-CYOSWFT2.js";import{a as Y,b as ee,c as ne,d as te,e as re,f as oe,g as se,h as ie,i as ae,j as ce,k as de,l as fe}from"./chunk-4MKL6Q3K.js";import{b as ur,c as pr,d as lr,e as hr,f as vr}from"./chunk-KNVCCBIU.js";import{a as Cr}from"./chunk-AI7QC7J6.js";import{a as gr,b as br}from"./chunk-NNKJUORL.js";import{a as yr,b as kr}from"./chunk-KGKJCHEK.js";import{a as ar,b as cr}from"./chunk-TZQPPQEQ.js";import{a as ke,b as tn}from"./chunk-5QDBSZBV.js";import{a as an,b as cn,c as dn,d as fn,e as un,f as pn,g as ln,h as mn,i as gn}from"./chunk-VXPLLA4P.js";import{a as xe}from"./chunk-L6NSJVJZ.js";import{a as rn,b as on,c as sn}from"./chunk-TT4C7DXW.js";import{a as ue}from"./chunk-POXANAJ6.js";import{a as Z}from"./chunk-ESMPEKEV.js";import{a as wr,b as Er,c as Nr,d as Mr,e as Sr,f as Rr,g as Br,h as Or,i as Wr,j as Ir,k as Lr}from"./chunk-D5RFJOZ2.js";import{a as xr,b as Tr}from"./chunk-CE72X3WO.js";import{A as Kn,B as Dn,C as Un,D as _n,E as $n,F as Fn,G as Hn,I as Gn,J as qn,K as Jn,L as Qn,M as Xn,N as Yn,O as Zn,P as et,Q as nt,R as tt,S as rt,T as ot,U as st,V as it,W as at,a as U,b as J,c as kn,d as hn,e as vn,f as xn,g as Tn,h as wn,i as Q,j as En,k as Nn,l as Mn,m as Sn,n as Rn,o as Bn,p as On,q as Wn,r as In,s as Ln,t as X,u as Cn,v as jn,w as Vn,x as Pn,y as An,z as zn}from"./chunk-AK5RHMC5.js";import{c as Te,d as we,e as Ee,f as Ne,g as Me,h as Se,i as Re}from"./chunk-4VVTGLXJ.js";import{A as Ye,B as Ze,C as en,D as nn,a as he,b as ve,c as Be,d as Oe,e as We,f as q,g as Ie,h as Le,i as Ce,j as je,k as Ve,l as Pe,m as Ae,n as ze,o as Ke,p as De,q as Ue,r as _e,s as $e,t as Fe,u as He,v as Ge,w as qe,x as Je,y as Qe,z as Xe}from"./chunk-L77I47VU.js";import{A as K,D as C,E as O,H as D,m as W}from"./chunk-LYCLF26R.js";import{b as h,e as $,f as F,g as H,h as S,i as G,j as B}from"./chunk-CK2E7BTU.js";import{b as ye}from"./chunk-QYADASLV.js";var Dr={};ye(Dr,{CircuitOpenError:()=>ne,ContentAddressedMissError:()=>ur,DEFAULT_AUDIT_GUARD:()=>cn,NS_PER_MS:()=>NS_PER_MS,NS_PER_SEC:()=>NS_PER_SEC,NativeIndexBackend:()=>gr,NativeListBackend:()=>yr,NativeLogBackend:()=>rn,NativeMapBackend:()=>ar,NativePubSubBackend:()=>_,RateLimiterOverflowError:()=>se,ResettableTimer:()=>Z,TimeoutError:()=>ce,appendAudit:()=>un,appendLogStorage:()=>Sr,audit:()=>Hn,awaitSettled:()=>Xe,budgetGate:()=>Y,buffer:()=>Gn,bufferCount:()=>qn,bufferTime:()=>Qn,bumpCursor:()=>fn,cached:()=>qe,canonicalJson:()=>pr,cascadingCache:()=>jr,catchError:()=>at,checkpointToRedis:()=>er,checkpointToS3:()=>Zt,circuitBreaker:()=>te,combine:()=>In,combineLatest:()=>ot,concat:()=>jn,concatMap:()=>zn,constant:()=>Te,contentAddressedStorage:()=>lr,createAuditLog:()=>dn,createTransport:()=>L,createWatermarkController:()=>tn,csvRows:()=>jt,debounce:()=>_n,debounceTime:()=>st,decay:()=>pe,decorrelatedJitter:()=>Me,defer:()=>_e,delay:()=>Un,deserializeError:()=>A,dictKv:()=>Ir,dictSnapshot:()=>Lr,distill:()=>fr,distinctUntilChanged:()=>On,domainMeta:()=>xe,elementAt:()=>Mn,empty:()=>Ke,escapeRegexChar:()=>Be,exhaustMap:()=>An,exponential:()=>Ee,externalBundle:()=>yn,externalProducer:()=>bn,fallback:()=>de,fibonacci:()=>Ne,filter:()=>J,find:()=>Nn,first:()=>Q,firstValueFrom:()=>Je,firstWhere:()=>Qe,flatMap:()=>Dn,forEach:()=>$e,fromAny:()=>Ae,fromAsyncIter:()=>Pe,fromCSV:()=>Ct,fromClickHouseWatch:()=>At,fromCron:()=>Le,fromDrizzle:()=>sr,fromEvent:()=>Ce,fromHTTP:()=>ut,fromHTTPPoll:()=>ht,fromHTTPStream:()=>kt,fromIter:()=>je,fromKafka:()=>Ot,fromKysely:()=>ir,fromMCP:()=>Tt,fromNATS:()=>Dt,fromNDJSON:()=>Pt,fromOTel:()=>wt,fromPrisma:()=>or,fromPrometheus:()=>Rt,fromPromise:()=>Ve,fromPulsar:()=>zt,fromRabbitMQ:()=>_t,fromRaf:()=>Ie,fromRedisStream:()=>It,fromSSE:()=>yt,fromSqlite:()=>nr,fromSqliteCursor:()=>tr,fromStatsD:()=>Mt,fromSyslog:()=>Et,fromTimer:()=>q,fromWebSocket:()=>dt,fromWebSocketReconnect:()=>xt,fromWebhook:()=>ft,globToRegExp:()=>Oe,interval:()=>Zn,jsonCodec:()=>wr,jsonCodecFor:()=>Er,keepalive:()=>en,kvStorage:()=>Rr,last:()=>En,lightMutation:()=>pn,linear:()=>we,lru:()=>le,makeHttpError:()=>mr,map:()=>U,matchesAnyPattern:()=>We,matchesCron:()=>ve,memoryAppendLog:()=>Or,memoryBackend:()=>Nr,memoryKv:()=>Wr,memorySnapshot:()=>Br,merge:()=>X,mergeMap:()=>Kn,mergeReactiveLogs:()=>sn,nameToSignal:()=>V,ndjsonRows:()=>Vt,never:()=>De,nodeSignal:()=>Ye,of:()=>ze,onFirstData:()=>Rn,pairwise:()=>Wn,parseCron:()=>he,parsePrometheusText:()=>Bt,parseSSEStream:()=>bt,parseStatsD:()=>St,parseSyslog:()=>Nt,pausable:()=>nt,pubsub:()=>Vr,race:()=>Vn,rateLimiter:()=>ie,reactiveCounter:()=>nn,reactiveIndex:()=>br,reactiveList:()=>kr,reactiveLog:()=>on,reactiveMap:()=>cr,reactiveSink:()=>ct,reduce:()=>hn,registerCursor:()=>mn,registerCursorMap:()=>gn,repeat:()=>et,replay:()=>Ge,rescue:()=>tt,resolveBackoffPreset:()=>Re,retry:()=>ee,sample:()=>Fn,scan:()=>kn,serializeError:()=>P,share:()=>He,shareReplay:()=>Ze,signalToName:()=>I,singleFromAny:()=>hr,singleNodeFromAny:()=>vr,skip:()=>xn,snapshotStorage:()=>Mr,sortJsonValue:()=>xr,stableJsonString:()=>Tr,stratify:()=>Cr,switchMap:()=>Pn,take:()=>vn,takeUntil:()=>wn,takeWhile:()=>Tn,tap:()=>Sn,tapFirst:()=>Bn,throttle:()=>$n,throttleTime:()=>it,throwError:()=>Ue,timeout:()=>fe,toArray:()=>Fe,toCSV:()=>Ht,toClickHouse:()=>Gt,toFile:()=>Ft,toHTTP:()=>pt,toKafka:()=>Wt,toLoki:()=>Xt,toMongo:()=>Qt,toNATS:()=>Ut,toObservable:()=>ke,toPostgres:()=>Jt,toPulsar:()=>Kt,toRabbitMQ:()=>$t,toReadableStream:()=>gt,toRedisStream:()=>Lt,toS3:()=>qt,toSSE:()=>lt,toSSEBytes:()=>mt,toSqlite:()=>rr,toTempo:()=>Yt,toWebSocket:()=>vt,tokenBucket:()=>oe,topologyDiff:()=>ue,tryIncrementBounded:()=>an,valve:()=>rt,verifiable:()=>dr,window:()=>Yn,windowCount:()=>Jn,windowTime:()=>Xn,withBreaker:()=>re,withLatestFrom:()=>Ln,withMaxAttempts:()=>Se,withStatus:()=>ae,workerBridge:()=>ge,workerSelf:()=>be,wrapMutation:()=>ln,zip:()=>Cn});function le(){let e=new Map,r=null,n=null;function p(t){t.prev?t.prev.next=t.next:r=t.next,t.next?t.next.prev=t.prev:n=t.prev,t.prev=null,t.next=null}function l(t){t.next=r,t.prev=null,r&&(r.prev=t),r=t,n===null&&(n=t)}return{insert(t){if(e.has(t)){this.touch(t);return}let f={key:t,prev:null,next:null};e.set(t,f),l(f)},touch(t){let f=e.get(t);f&&(p(f),l(f))},delete(t){let f=e.get(t);f&&(p(f),e.delete(t))},evict(t){let f=[];for(let v=0;v<t&&n!==null;v++){let N=n;f.push(N.key),p(N),e.delete(N.key)}return f},size(){return e.size}}}function me(e){return e!=null&&typeof e.then=="function"}function j(e){me(e)&&e.catch(()=>{})}function jr(e,r){let n=new Map,p=r?.maxSize??0,l=p>0?r?.eviction??le():null,t=r?.writeThrough??!1;function f(o,u,m){for(let g=0;g<m;g++)try{j(e[g].save(o,u))}catch{}}function v(o,u,m=0){for(let g=m;g<e.length;g++){let w;try{w=e[g].load(o)}catch{continue}if(me(w)){let T=g;w.then(M=>{M!==void 0?(u.down([[h,M]]),f(o,M,T)):v(o,u,T+1)},()=>{v(o,u,T+1)});return}if(w!==void 0){u.down([[h,w]]),f(o,w,g);return}}}function N(){if(!(!l||p<=0))for(;l.size()>=p;){let o=l.evict(1);if(o.length===0)break;for(let u of o){let m=n.get(u);if(m){let g=m.cache;if(m.status!=="sentinel"&&e.length>0){let w=e.length-1;try{j(e[w].save(u,g))}catch{}for(let T=0;T<w;T++)try{let M=e[T].delete;M&&j(M.call(e[T],u))}catch{}}m.down([[S]])}n.delete(u)}}}return{load(o){let u=n.get(o);if(u)return l?.touch(o),u;l&&p>0&&l.size()>=p&&N();let m=O(void 0);return n.set(o,m),l?.insert(o),v(o,m),m},save(o,u){if(t)for(let g of e)try{j(g.save(o,u))}catch{}else if(e[0])try{j(e[0].save(o,u))}catch{}let m=n.get(o);if(m)m.down([[h,u]]),l?.touch(o);else{l&&p>0&&l.size()>=p&&N();let g=O(u);n.set(o,g),l?.insert(o)}},invalidate(o){let u=n.get(o);u&&v(o,u)},delete(o){l?.delete(o);let u=n.get(o);u&&u.down([[S]]),n.delete(o);for(let m of e)try{let g=m.delete;g&&j(g.call(m,o))}catch{}},has(o){return n.has(o)},get size(){return n.size}}}var _=class{_version=0;_topics=new Set;get version(){return this._version}get topicCount(){return this._topics.size}hasTopic(r){return this._topics.has(r)}topicNames(){return this._topics.values()}createTopic(r){return this._topics.has(r)?!1:(this._topics.add(r),this._version+=1,!0)}removeTopic(r){let n=this._topics.delete(r);return n&&(this._version+=1),n}};function Vr(e={}){let{backend:r}=e,n=r??new _,p=new Map;function l(t){let f=p.get(t);return f===void 0&&(f=C({describeKind:"state"}),p.set(t,f),n.createTopic(t)),f}return{topic(t){return l(t)},publish(t,f){l(t).emit(f)},publishMany(t){W(()=>{for(let[f,v]of t)l(f).emit(v)})},removeTopic(t){let f=p.get(t);return f===void 0?!1:(p.delete(t),n.removeTopic(t),f.down([[S]]),!0)},has(t){return n.hasTopic(t)},get size(){return n.topicCount},topicNames(){return n.topicNames()}}}var Pr=new Map([[$,"INVALIDATE"],[F,"PAUSE"],[H,"RESUME"],[S,"TEARDOWN"],[G,"COMPLETE"],[B,"ERROR"]]),Ar=new Map([["INVALIDATE",$],["PAUSE",F],["RESUME",H],["TEARDOWN",S],["COMPLETE",G],["ERROR",B]]);function I(e){let r=Pr.get(e);return r||(Symbol.keyFor(e)??"UNKNOWN")}function V(e){let r=Ar.get(e);if(r)return r;if(e&&e!=="UNKNOWN")return Symbol.for(e)}function P(e){return e instanceof Error?{message:e.message,name:e.name,stack:e.stack}:{message:String(e),name:"Error"}}function A(e){let r=new Error(e.message);return r.name=e.name,e.stack&&(r.stack=e.stack),r}function L(e){if(typeof MessagePort<"u"&&e instanceof MessagePort)return{post(r,n){e.postMessage(r,n??[])},listen(r){let n=p=>r(p.data);return e.addEventListener("message",n),e.start(),()=>e.removeEventListener("message",n)},terminate(){e.close()}};if(typeof SharedWorker<"u"&&e instanceof SharedWorker)return L(e.port);if(typeof Worker<"u"&&e instanceof Worker)return{post(r,n){e.postMessage(r,n??[])},listen(r){let n=p=>r(p.data);return e.addEventListener("message",n),()=>e.removeEventListener("message",n)},terminate(){e.terminate()}};if(typeof BroadcastChannel<"u"&&e instanceof BroadcastChannel)return{post(r,n){n&&n.length>0&&console.warn("[graphrefly] WorkerTransport: BroadcastChannel does not support Transferable objects. The transfer argument is ignored and objects will be cloned instead."),e.postMessage(r)},listen(r){let n=p=>r(p.data);return e.addEventListener("message",n),()=>e.removeEventListener("message",n)},terminate(){e.close()}};if(typeof ServiceWorker<"u"&&e instanceof ServiceWorker)return{post(r,n){e.postMessage(r,n??[])},listen(r){let n=p=>{p.source===e&&r(p.data)};return navigator.serviceWorker.addEventListener("message",n),()=>navigator.serviceWorker.removeEventListener("message",n)}};throw new Error("createTransport: unsupported target type. Expected Worker, SharedWorker, ServiceWorker, BroadcastChannel, or MessagePort.")}function zr(e){return typeof e=="object"&&e!==null&&typeof e.post=="function"&&typeof e.listen=="function"}function ge(e,r){let n=zr(e)?e:L(e),p=r.name??"workerBridge",l=Object.entries(r.expose??{}),t=r.import??[],f=r.transfer??{},v=O("connecting",{name:`${p}::meta::status`}),N=O(null,{name:`${p}::meta::error`}),o=new Map,u=new Map;for(let c of t){let a=O(void 0,{name:`${p}::${c}`});o.set(c,a)}let m;if(l.length>0){let c=l.map(([,d])=>d),a=C(c,(d,i)=>{let k={};for(let y=0;y<l.length;y++){let[R]=l[y],E=d[y];E!=null&&E.length>0&&(k[R]=E.at(-1))}Object.keys(k).length!==0&&i.emit(k)},{name:`${p}::aggregated`,partial:!0});m=D([a],d=>{let i=d[0];if(i==null||Object.keys(i).length===0)return;let k=[];for(let E of Object.keys(i)){let z=f[E];z&&k.push(...z(i[E]))}let y;for(let[E,z]of l)E in i&&z.v!=null&&(y==null&&(y={}),y[E]=z.v.version);let R={t:"b",u:i,...y?{v:y}:{}};try{n.post(R,k.length>0?k:void 0)}catch(E){N.down([[h,E instanceof Error?E:new Error(String(E))]])}}).subscribe(()=>{})}let g=!1,w=n.listen(c=>{if(g)return;let a=c;switch(a.t){case"r":{W(()=>{for(let[d,i]of Object.entries(a.stores)){let k=o.get(d);k&&k.down([[h,i]])}}),v.down([[h,"connected"]]);let s={};for(let[d,i]of l)s[d]=i.cache;n.post({t:"i",stores:s});break}case"v":{let s=o.get(a.s);s&&s.down([[h,a.d]]);break}case"b":{W(()=>{for(let[s,d]of Object.entries(a.u)){let i=a.v?.[s];if(i!=null){let y=u.get(s);if(y!=null&&i<=y)continue;u.set(s,i)}let k=o.get(s);k&&k.down([[h,d]])}});break}case"e":{let s=o.get(a.s);s&&s.down([[B,A(a.err)]]);break}case"s":{let s=V(a.sig);if(!s)break;let d=a.s==="*"?[...o.values()]:o.has(a.s)?[o.get(a.s)]:[];for(let i of d)i.down(a.d===void 0?[[s]]:[[s,a.d]]);break}}}),T=[];for(let[c,a]of l){let s=a.subscribe((d=>{if(!g)for(let i of d){let k=i[0];k!==h&&(K.isLocalOnly(k)||(k===B?n.post({t:"e",s:c,err:P(i[1])}):n.post({t:"s",s:c,sig:I(k),d:i.length>1?i[1]:void 0})))}}));T.push(s)}let M;if(r.timeoutMs!=null&&r.timeoutMs>0){let c=q(r.timeoutMs),a=J(v,d=>d==="connected");M=Q(X(U(c,()=>"timeout"),U(a,()=>"ready"))).subscribe(d=>{for(let i of d)i[0]===h&&i[1]==="timeout"&&(N.down([[h,new Error("Worker bridge handshake timeout")]]),x())})}function x(){if(!g){g=!0,M?.(),n.post({t:"s",s:"*",sig:I(S)}),m&&m();for(let c of T)c();T.length=0,w(),v.down([[h,"closed"]]),u.clear(),o.clear()}}let b={meta:{status:v,error:N},destroy:x};for(let[c,a]of o)b[c]=a;return b}function Kr(e){return typeof e=="object"&&e!==null&&typeof e.post=="function"&&typeof e.listen=="function"}function be(e,r){let n=Kr(e)?e:L(e),p=r.import??[],l=r.transfer??{},t=new Map,f=new Map,v={};for(let x of p){let b=O(void 0,{name:`worker::${x}`});t.set(x,b),v[x]=b}let N=r.expose(v),o=Object.entries(N),u,m=!1;if(o.length>0){let x=o.map(([,a])=>a),b=C(x,(a,s)=>{let d={};for(let i=0;i<o.length;i++){let[k]=o[i],y=a[i];y!=null&&y.length>0&&(d[k]=y.at(-1))}Object.keys(d).length!==0&&s.emit(d)},{name:"workerSelf::aggregated",partial:!0});u=D([b],a=>{if(m)return;let s=a[0];if(s==null||Object.keys(s).length===0)return;let d=[];for(let y of Object.keys(s)){let R=l[y];R&&d.push(...R(s[y]))}let i;for(let[y,R]of o)y in s&&R.v!=null&&(i==null&&(i={}),i[y]=R.v.version);let k={t:"b",u:s,...i?{v:i}:{}};try{n.post(k,d.length>0?d:void 0)}catch{}}).subscribe(()=>{})}let g=[];for(let[x,b]of o){let c=b.subscribe((a=>{if(!m)for(let s of a){let d=s[0];d!==h&&(K.isLocalOnly(d)||(d===B?n.post({t:"e",s:x,err:P(s[1])}):n.post({t:"s",s:x,sig:I(d),d:s.length>1?s[1]:void 0})))}}));g.push(c)}let w=n.listen(x=>{if(m)return;let b=x;switch(b.t){case"i":{W(()=>{for(let[c,a]of Object.entries(b.stores)){let s=t.get(c);s&&s.down([[h,a]])}});break}case"v":{let c=t.get(b.s);c&&c.down([[h,b.d]]);break}case"b":{W(()=>{for(let[c,a]of Object.entries(b.u)){let s=b.v?.[c];if(s!=null){let i=f.get(c);if(i!=null&&s<=i)continue;f.set(c,s)}let d=t.get(c);d&&d.down([[h,a]])}});break}case"e":{let c=t.get(b.s);c&&c.down([[B,A(b.err)]]);break}case"s":{let c=V(b.sig);if(!c)break;if(c===S&&b.s==="*"){M();return}let a=b.s==="*"?[...t.values()]:t.has(b.s)?[t.get(b.s)]:[];for(let s of a)s.down(b.d===void 0?[[c]]:[[c,b.d]]);break}}}),T={};for(let[x,b]of o)T[x]=b.cache;n.post({t:"r",stores:T});function M(){if(!m){m=!0,u&&u();for(let x of g)x();g.length=0,w(),n.terminate?.(),f.clear(),t.clear()}}return{destroy:M}}export{le as a,jr as b,_ as c,Vr as d,I as e,V as f,P as g,A as h,L as i,ge as j,be as k,Dr as l};
|
|
1
|
+
import{a as dr,b as fr}from"./chunk-6HOSXQKF.js";import{b as pe}from"./chunk-TSOYJ743.js";import{$ as sr,A as It,B as Lt,C as Ct,D as jt,E as Vt,F as Pt,G as At,H as zt,I as Kt,J as Dt,K as Ut,L as _t,M as $t,N as Ft,O as Ht,P as Gt,Q as qt,R as Jt,S as Qt,T as Xt,U as Yt,V as Zt,W as er,X as nr,Y as tr,Z as rr,_ as or,a as it,aa as ir,b as at,ba as mr,c as ct,d as dt,e as ft,f as ut,g as pt,h as lt,i as mt,j as gt,k as bt,l as yt,m as kt,n as ht,o as vt,p as xt,q as Tt,r as wt,s as Et,t as Nt,u as Mt,v as St,w as Rt,x as Bt,y as Ot,z as Wt}from"./chunk-O2BLLH7M.js";import{a as Y,d as ne,e as te,f as re,g as oe,h as se,i as ie,j as ae,k as ce,l as de,m as fe,n as ue}from"./chunk-VNC3TMVY.js";import{b as ur,c as pr,d as lr,e as hr,f as vr}from"./chunk-XG62INFA.js";import{a as Cr}from"./chunk-4YAN45KM.js";import{a as ke,b as Gn}from"./chunk-5QDBSZBV.js";import{a as Xn,b as Yn,c as Zn,d as et,e as nt,f as tt,g as rt,h as ot,i as st}from"./chunk-FDQGFWLF.js";import{a as xe}from"./chunk-L6NSJVJZ.js";import{e as Z}from"./chunk-626TESAC.js";import{a as ee}from"./chunk-ESMPEKEV.js";import{a as wr,b as Er,c as Nr,d as Mr,e as Sr,f as Rr,g as Br,h as Or,i as Wr,j as Ir,k as Lr}from"./chunk-D5RFJOZ2.js";import{a as xr,b as Tr}from"./chunk-CE72X3WO.js";import{A as Xe,B as Ye,C as Ze,D as en,E as nn,F as tn,G as rn,I as on,J as sn,K as an,L as cn,M as dn,N as fn,O as un,P as pn,Q as ln,R as mn,S as gn,T as bn,U as yn,V as kn,W as hn,a as U,b as q,c as Be,d as Oe,e as We,f as Ie,g as Le,h as Ce,i as J,j as je,k as Ve,l as Pe,m as Ae,n as ze,o as Ke,p as De,q as Ue,r as _e,s as $e,t as Q,u as Fe,v as He,w as Ge,x as qe,y as Je,z as Qe}from"./chunk-VOPGGIL7.js";import{c as Te,d as we,e as Ee,f as Ne,g as Me,h as Se,i as Re}from"./chunk-4VVTGLXJ.js";import{a as gr,b as br}from"./chunk-NNKJUORL.js";import{a as yr,b as kr}from"./chunk-KGKJCHEK.js";import{a as ar,b as cr}from"./chunk-TZQPPQEQ.js";import{a as qn,b as Jn,c as Qn}from"./chunk-JQFH2DV6.js";import{A as _n,B as $n,C as Fn,D as Hn,a as he,b as ve,c as vn,d as xn,e as Tn,f as X,g as wn,h as En,i as Nn,j as Mn,k as Sn,l as Rn,m as Bn,n as On,o as Wn,p as In,q as Ln,r as Cn,s as jn,t as Vn,u as Pn,v as An,w as zn,x as Kn,y as Dn,z as Un}from"./chunk-V5A7M7RJ.js";import{A as K,D as C,E as O,H as D,m as W}from"./chunk-LYCLF26R.js";import{b as h,e as $,f as F,g as H,h as S,i as G,j as B}from"./chunk-CK2E7BTU.js";import{b as ye}from"./chunk-QYADASLV.js";var Dr={};ye(Dr,{CircuitOpenError:()=>te,ContentAddressedMissError:()=>ur,DEFAULT_AUDIT_GUARD:()=>Yn,NS_PER_MS:()=>NS_PER_MS,NS_PER_SEC:()=>NS_PER_SEC,NativeIndexBackend:()=>gr,NativeListBackend:()=>yr,NativeLogBackend:()=>qn,NativeMapBackend:()=>ar,NativePubSubBackend:()=>_,RateLimiterOverflowError:()=>ie,ResettableTimer:()=>ee,TimeoutError:()=>de,appendAudit:()=>nt,appendLogStorage:()=>Sr,audit:()=>rn,awaitSettled:()=>Un,budgetGate:()=>Y,buffer:()=>on,bufferCount:()=>sn,bufferTime:()=>cn,bumpCursor:()=>et,cached:()=>zn,canonicalJson:()=>pr,cascadingCache:()=>jr,catchError:()=>hn,checkpointToRedis:()=>er,checkpointToS3:()=>Zt,circuitBreaker:()=>re,combine:()=>_e,combineLatest:()=>bn,concat:()=>He,concatMap:()=>Qe,constant:()=>Te,contentAddressedStorage:()=>lr,createAuditLog:()=>Zn,createTransport:()=>L,createWatermarkController:()=>Gn,csvRows:()=>jt,debounce:()=>en,debounceTime:()=>yn,decay:()=>pe,decorrelatedJitter:()=>Me,defer:()=>Cn,delay:()=>Ze,deserializeError:()=>A,dictKv:()=>Ir,dictSnapshot:()=>Lr,distill:()=>fr,distinctUntilChanged:()=>De,domainMeta:()=>xe,elementAt:()=>Pe,empty:()=>Wn,escapeRegexChar:()=>vn,exhaustMap:()=>Je,exponential:()=>Ee,externalBundle:()=>at,externalProducer:()=>it,fallback:()=>fe,fibonacci:()=>Ne,filter:()=>q,find:()=>Ve,first:()=>J,firstValueFrom:()=>Kn,firstWhere:()=>Dn,flatMap:()=>Ye,forEach:()=>jn,fromAny:()=>Bn,fromAsyncIter:()=>Rn,fromCSV:()=>Ct,fromClickHouseWatch:()=>At,fromCron:()=>En,fromDrizzle:()=>sr,fromEvent:()=>Nn,fromHTTP:()=>ut,fromHTTPPoll:()=>ht,fromHTTPStream:()=>kt,fromIter:()=>Mn,fromKafka:()=>Ot,fromKysely:()=>ir,fromMCP:()=>Tt,fromNATS:()=>Dt,fromNDJSON:()=>Pt,fromOTel:()=>wt,fromPrisma:()=>or,fromPrometheus:()=>Rt,fromPromise:()=>Sn,fromPulsar:()=>zt,fromRabbitMQ:()=>_t,fromRaf:()=>wn,fromRedisStream:()=>It,fromSSE:()=>yt,fromSqlite:()=>nr,fromSqliteCursor:()=>tr,fromStatsD:()=>Mt,fromSyslog:()=>Et,fromTimer:()=>X,fromWebSocket:()=>dt,fromWebSocketReconnect:()=>xt,fromWebhook:()=>ft,globToRegExp:()=>xn,interval:()=>un,jsonCodec:()=>wr,jsonCodecFor:()=>Er,keepalive:()=>Fn,kvStorage:()=>Rr,last:()=>je,lightMutation:()=>tt,linear:()=>we,lru:()=>le,makeHttpError:()=>mr,map:()=>U,matchesAnyPattern:()=>Tn,matchesCron:()=>ve,memoryAppendLog:()=>Or,memoryBackend:()=>Nr,memoryKv:()=>Wr,memorySnapshot:()=>Br,merge:()=>Q,mergeMap:()=>Xe,mergeReactiveLogs:()=>Qn,nameToSignal:()=>V,ndjsonRows:()=>Vt,never:()=>In,nodeSignal:()=>_n,of:()=>On,onFirstData:()=>ze,pairwise:()=>Ue,parseCron:()=>he,parsePrometheusText:()=>Bt,parseSSEStream:()=>bt,parseStatsD:()=>St,parseSyslog:()=>Nt,pausable:()=>ln,pubsub:()=>Vr,race:()=>Ge,rateLimiter:()=>ae,reactiveCounter:()=>Hn,reactiveIndex:()=>br,reactiveList:()=>kr,reactiveLog:()=>Jn,reactiveMap:()=>cr,reactiveSink:()=>ct,reduce:()=>Oe,registerCursor:()=>ot,registerCursorMap:()=>st,repeat:()=>pn,replay:()=>An,rescue:()=>mn,resolveBackoffPreset:()=>Re,retry:()=>ne,sample:()=>tn,scan:()=>Be,serializeError:()=>P,share:()=>Pn,shareReplay:()=>$n,signalToName:()=>I,singleFromAny:()=>hr,singleNodeFromAny:()=>vr,skip:()=>Ie,snapshotStorage:()=>Mr,sortJsonValue:()=>xr,stableJsonString:()=>Tr,stratify:()=>Cr,switchMap:()=>qe,take:()=>We,takeUntil:()=>Ce,takeWhile:()=>Le,tap:()=>Ae,tapFirst:()=>Ke,throttle:()=>nn,throttleTime:()=>kn,throwError:()=>Ln,timeout:()=>ue,toArray:()=>Vn,toCSV:()=>Ht,toClickHouse:()=>Gt,toFile:()=>Ft,toHTTP:()=>pt,toKafka:()=>Wt,toLoki:()=>Xt,toMongo:()=>Qt,toNATS:()=>Ut,toObservable:()=>ke,toPostgres:()=>Jt,toPulsar:()=>Kt,toRabbitMQ:()=>$t,toReadableStream:()=>gt,toRedisStream:()=>Lt,toS3:()=>qt,toSSE:()=>lt,toSSEBytes:()=>mt,toSqlite:()=>rr,toTempo:()=>Yt,toWebSocket:()=>vt,tokenBucket:()=>se,topologyDiff:()=>Z,tryIncrementBounded:()=>Xn,valve:()=>gn,verifiable:()=>dr,window:()=>fn,windowCount:()=>an,windowTime:()=>dn,withBreaker:()=>oe,withLatestFrom:()=>$e,withMaxAttempts:()=>Se,withStatus:()=>ce,workerBridge:()=>ge,workerSelf:()=>be,wrapMutation:()=>rt,zip:()=>Fe});function le(){let e=new Map,r=null,n=null;function p(t){t.prev?t.prev.next=t.next:r=t.next,t.next?t.next.prev=t.prev:n=t.prev,t.prev=null,t.next=null}function l(t){t.next=r,t.prev=null,r&&(r.prev=t),r=t,n===null&&(n=t)}return{insert(t){if(e.has(t)){this.touch(t);return}let f={key:t,prev:null,next:null};e.set(t,f),l(f)},touch(t){let f=e.get(t);f&&(p(f),l(f))},delete(t){let f=e.get(t);f&&(p(f),e.delete(t))},evict(t){let f=[];for(let v=0;v<t&&n!==null;v++){let N=n;f.push(N.key),p(N),e.delete(N.key)}return f},size(){return e.size}}}function me(e){return e!=null&&typeof e.then=="function"}function j(e){me(e)&&e.catch(()=>{})}function jr(e,r){let n=new Map,p=r?.maxSize??0,l=p>0?r?.eviction??le():null,t=r?.writeThrough??!1;function f(o,u,m){for(let g=0;g<m;g++)try{j(e[g].save(o,u))}catch{}}function v(o,u,m=0){for(let g=m;g<e.length;g++){let w;try{w=e[g].load(o)}catch{continue}if(me(w)){let T=g;w.then(M=>{M!==void 0?(u.down([[h,M]]),f(o,M,T)):v(o,u,T+1)},()=>{v(o,u,T+1)});return}if(w!==void 0){u.down([[h,w]]),f(o,w,g);return}}}function N(){if(!(!l||p<=0))for(;l.size()>=p;){let o=l.evict(1);if(o.length===0)break;for(let u of o){let m=n.get(u);if(m){let g=m.cache;if(m.status!=="sentinel"&&e.length>0){let w=e.length-1;try{j(e[w].save(u,g))}catch{}for(let T=0;T<w;T++)try{let M=e[T].delete;M&&j(M.call(e[T],u))}catch{}}m.down([[S]])}n.delete(u)}}}return{load(o){let u=n.get(o);if(u)return l?.touch(o),u;l&&p>0&&l.size()>=p&&N();let m=O(void 0);return n.set(o,m),l?.insert(o),v(o,m),m},save(o,u){if(t)for(let g of e)try{j(g.save(o,u))}catch{}else if(e[0])try{j(e[0].save(o,u))}catch{}let m=n.get(o);if(m)m.down([[h,u]]),l?.touch(o);else{l&&p>0&&l.size()>=p&&N();let g=O(u);n.set(o,g),l?.insert(o)}},invalidate(o){let u=n.get(o);u&&v(o,u)},delete(o){l?.delete(o);let u=n.get(o);u&&u.down([[S]]),n.delete(o);for(let m of e)try{let g=m.delete;g&&j(g.call(m,o))}catch{}},has(o){return n.has(o)},get size(){return n.size}}}var _=class{_version=0;_topics=new Set;get version(){return this._version}get topicCount(){return this._topics.size}hasTopic(r){return this._topics.has(r)}topicNames(){return this._topics.values()}createTopic(r){return this._topics.has(r)?!1:(this._topics.add(r),this._version+=1,!0)}removeTopic(r){let n=this._topics.delete(r);return n&&(this._version+=1),n}};function Vr(e={}){let{backend:r}=e,n=r??new _,p=new Map;function l(t){let f=p.get(t);return f===void 0&&(f=C({describeKind:"state"}),p.set(t,f),n.createTopic(t)),f}return{topic(t){return l(t)},publish(t,f){l(t).emit(f)},publishMany(t){W(()=>{for(let[f,v]of t)l(f).emit(v)})},removeTopic(t){let f=p.get(t);return f===void 0?!1:(p.delete(t),n.removeTopic(t),f.down([[S]]),!0)},has(t){return n.hasTopic(t)},get size(){return n.topicCount},topicNames(){return n.topicNames()}}}var Pr=new Map([[$,"INVALIDATE"],[F,"PAUSE"],[H,"RESUME"],[S,"TEARDOWN"],[G,"COMPLETE"],[B,"ERROR"]]),Ar=new Map([["INVALIDATE",$],["PAUSE",F],["RESUME",H],["TEARDOWN",S],["COMPLETE",G],["ERROR",B]]);function I(e){let r=Pr.get(e);return r||(Symbol.keyFor(e)??"UNKNOWN")}function V(e){let r=Ar.get(e);if(r)return r;if(e&&e!=="UNKNOWN")return Symbol.for(e)}function P(e){return e instanceof Error?{message:e.message,name:e.name,stack:e.stack}:{message:String(e),name:"Error"}}function A(e){let r=new Error(e.message);return r.name=e.name,e.stack&&(r.stack=e.stack),r}function L(e){if(typeof MessagePort<"u"&&e instanceof MessagePort)return{post(r,n){e.postMessage(r,n??[])},listen(r){let n=p=>r(p.data);return e.addEventListener("message",n),e.start(),()=>e.removeEventListener("message",n)},terminate(){e.close()}};if(typeof SharedWorker<"u"&&e instanceof SharedWorker)return L(e.port);if(typeof Worker<"u"&&e instanceof Worker)return{post(r,n){e.postMessage(r,n??[])},listen(r){let n=p=>r(p.data);return e.addEventListener("message",n),()=>e.removeEventListener("message",n)},terminate(){e.terminate()}};if(typeof BroadcastChannel<"u"&&e instanceof BroadcastChannel)return{post(r,n){n&&n.length>0&&console.warn("[graphrefly] WorkerTransport: BroadcastChannel does not support Transferable objects. The transfer argument is ignored and objects will be cloned instead."),e.postMessage(r)},listen(r){let n=p=>r(p.data);return e.addEventListener("message",n),()=>e.removeEventListener("message",n)},terminate(){e.close()}};if(typeof ServiceWorker<"u"&&e instanceof ServiceWorker)return{post(r,n){e.postMessage(r,n??[])},listen(r){let n=p=>{p.source===e&&r(p.data)};return navigator.serviceWorker.addEventListener("message",n),()=>navigator.serviceWorker.removeEventListener("message",n)}};throw new Error("createTransport: unsupported target type. Expected Worker, SharedWorker, ServiceWorker, BroadcastChannel, or MessagePort.")}function zr(e){return typeof e=="object"&&e!==null&&typeof e.post=="function"&&typeof e.listen=="function"}function ge(e,r){let n=zr(e)?e:L(e),p=r.name??"workerBridge",l=Object.entries(r.expose??{}),t=r.import??[],f=r.transfer??{},v=O("connecting",{name:`${p}::meta::status`}),N=O(null,{name:`${p}::meta::error`}),o=new Map,u=new Map;for(let c of t){let a=O(void 0,{name:`${p}::${c}`});o.set(c,a)}let m;if(l.length>0){let c=l.map(([,d])=>d),a=C(c,(d,i)=>{let k={};for(let y=0;y<l.length;y++){let[R]=l[y],E=d[y];E!=null&&E.length>0&&(k[R]=E.at(-1))}Object.keys(k).length!==0&&i.emit(k)},{name:`${p}::aggregated`,partial:!0});m=D([a],d=>{let i=d[0];if(i==null||Object.keys(i).length===0)return;let k=[];for(let E of Object.keys(i)){let z=f[E];z&&k.push(...z(i[E]))}let y;for(let[E,z]of l)E in i&&z.v!=null&&(y==null&&(y={}),y[E]=z.v.version);let R={t:"b",u:i,...y?{v:y}:{}};try{n.post(R,k.length>0?k:void 0)}catch(E){N.down([[h,E instanceof Error?E:new Error(String(E))]])}}).subscribe(()=>{})}let g=!1,w=n.listen(c=>{if(g)return;let a=c;switch(a.t){case"r":{W(()=>{for(let[d,i]of Object.entries(a.stores)){let k=o.get(d);k&&k.down([[h,i]])}}),v.down([[h,"connected"]]);let s={};for(let[d,i]of l)s[d]=i.cache;n.post({t:"i",stores:s});break}case"v":{let s=o.get(a.s);s&&s.down([[h,a.d]]);break}case"b":{W(()=>{for(let[s,d]of Object.entries(a.u)){let i=a.v?.[s];if(i!=null){let y=u.get(s);if(y!=null&&i<=y)continue;u.set(s,i)}let k=o.get(s);k&&k.down([[h,d]])}});break}case"e":{let s=o.get(a.s);s&&s.down([[B,A(a.err)]]);break}case"s":{let s=V(a.sig);if(!s)break;let d=a.s==="*"?[...o.values()]:o.has(a.s)?[o.get(a.s)]:[];for(let i of d)i.down(a.d===void 0?[[s]]:[[s,a.d]]);break}}}),T=[];for(let[c,a]of l){let s=a.subscribe((d=>{if(!g)for(let i of d){let k=i[0];k!==h&&(K.isLocalOnly(k)||(k===B?n.post({t:"e",s:c,err:P(i[1])}):n.post({t:"s",s:c,sig:I(k),d:i.length>1?i[1]:void 0})))}}));T.push(s)}let M;if(r.timeoutMs!=null&&r.timeoutMs>0){let c=X(r.timeoutMs),a=q(v,d=>d==="connected");M=J(Q(U(c,()=>"timeout"),U(a,()=>"ready"))).subscribe(d=>{for(let i of d)i[0]===h&&i[1]==="timeout"&&(N.down([[h,new Error("Worker bridge handshake timeout")]]),x())})}function x(){if(!g){g=!0,M?.(),n.post({t:"s",s:"*",sig:I(S)}),m&&m();for(let c of T)c();T.length=0,w(),v.down([[h,"closed"]]),u.clear(),o.clear()}}let b={meta:{status:v,error:N},destroy:x};for(let[c,a]of o)b[c]=a;return b}function Kr(e){return typeof e=="object"&&e!==null&&typeof e.post=="function"&&typeof e.listen=="function"}function be(e,r){let n=Kr(e)?e:L(e),p=r.import??[],l=r.transfer??{},t=new Map,f=new Map,v={};for(let x of p){let b=O(void 0,{name:`worker::${x}`});t.set(x,b),v[x]=b}let N=r.expose(v),o=Object.entries(N),u,m=!1;if(o.length>0){let x=o.map(([,a])=>a),b=C(x,(a,s)=>{let d={};for(let i=0;i<o.length;i++){let[k]=o[i],y=a[i];y!=null&&y.length>0&&(d[k]=y.at(-1))}Object.keys(d).length!==0&&s.emit(d)},{name:"workerSelf::aggregated",partial:!0});u=D([b],a=>{if(m)return;let s=a[0];if(s==null||Object.keys(s).length===0)return;let d=[];for(let y of Object.keys(s)){let R=l[y];R&&d.push(...R(s[y]))}let i;for(let[y,R]of o)y in s&&R.v!=null&&(i==null&&(i={}),i[y]=R.v.version);let k={t:"b",u:s,...i?{v:i}:{}};try{n.post(k,d.length>0?d:void 0)}catch{}}).subscribe(()=>{})}let g=[];for(let[x,b]of o){let c=b.subscribe((a=>{if(!m)for(let s of a){let d=s[0];d!==h&&(K.isLocalOnly(d)||(d===B?n.post({t:"e",s:x,err:P(s[1])}):n.post({t:"s",s:x,sig:I(d),d:s.length>1?s[1]:void 0})))}}));g.push(c)}let w=n.listen(x=>{if(m)return;let b=x;switch(b.t){case"i":{W(()=>{for(let[c,a]of Object.entries(b.stores)){let s=t.get(c);s&&s.down([[h,a]])}});break}case"v":{let c=t.get(b.s);c&&c.down([[h,b.d]]);break}case"b":{W(()=>{for(let[c,a]of Object.entries(b.u)){let s=b.v?.[c];if(s!=null){let i=f.get(c);if(i!=null&&s<=i)continue;f.set(c,s)}let d=t.get(c);d&&d.down([[h,a]])}});break}case"e":{let c=t.get(b.s);c&&c.down([[B,A(b.err)]]);break}case"s":{let c=V(b.sig);if(!c)break;if(c===S&&b.s==="*"){M();return}let a=b.s==="*"?[...t.values()]:t.has(b.s)?[t.get(b.s)]:[];for(let s of a)s.down(b.d===void 0?[[c]]:[[c,b.d]]);break}}}),T={};for(let[x,b]of o)T[x]=b.cache;n.post({t:"r",stores:T});function M(){if(!m){m=!0,u&&u();for(let x of g)x();g.length=0,w(),n.terminate?.(),f.clear(),t.clear()}}return{destroy:M}}export{le as a,jr as b,_ as c,Vr as d,I as e,V as f,P as g,A as h,L as i,ge as j,be as k,Dr as l};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as ne}from"./chunk-TSOYJ743.js";import{b as L}from"./chunk-TZQPPQEQ.js";import{c as W,d as ee,f as N,h as J}from"./chunk-VXPLLA4P.js";import{a as te}from"./chunk-L6NSJVJZ.js";import{i as P}from"./chunk-POXANAJ6.js";import{C as I,f as oe}from"./chunk-L77I47VU.js";import{C as Y,E as Z,G as x,o as V,p as X}from"./chunk-LYCLF26R.js";import{b as ce}from"./chunk-QYADASLV.js";var pe={};ce(pe,{collection:()=>fe,cosineSimilarity:()=>de,knowledgeGraph:()=>me,vectorIndex:()=>ye});var le=1e9;function S(o,t){return te("memory",o,t)}function $(o,t){return o instanceof Y?o:Z(o,t?{name:t}:void 0)}function re(o,t){return(o-t)/le}function de(o,t){let g=Math.max(o.length,t.length),r=0,d=0,f=0;for(let y=0;y<g;y+=1){let R=o[y]??0,k=t[y]??0;r+=R*k,d+=R*R,f+=k*k}if(d===0||f===0)return 0;let l=r/Math.sqrt(d*f);return Number.isFinite(l)?l:0}function ue(o,t){if(o===t)return!0;if(o==null||t==null||o.length!==t.length)return!1;for(let g=0;g<o.length;g+=1){let r=o[g],d=t[g];if(r.id!==d.id||r.score!==d.score||r.meta!==d.meta)return!1}return!0}function ge(o,t){if(o===t)return!0;if(o==null||t==null||o.length!==t.length)return!1;for(let g=0;g<o.length;g+=1){let r=o[g],d=t[g];if(r.id!==d.id||r.score!==d.score||r.lastAccessNs!==d.lastAccessNs||r.value!==d.value)return!1}return!0}function fe(o,t={}){let g=t.maxSize,r=t.ranked??!0,d=r?t.decayRate??0:0,f=t.minScore??0;if(g!==void 0&&g<1)throw new RangeError("collection: maxSize must be >= 1");let l=()=>r?1:0,y=t.score??l,R=r&&y instanceof Y?y:void 0,k=()=>R?R.cache??l:y,v=new P(o),p=L({name:"items",...g!==void 0?{retention:{score:(n,c)=>r?ne(c.baseScore,re(V(),c.lastAccessNs),d,f):c.lastAccessNs,maxSize:g}}:{}});v.add(p.entries,{name:"items"});let E;if(r&&d>0){let n=t.refreshIntervalMs??Math.max(1,1e3*Math.LN2/(10*d)),c=oe(n,{period:n});E=x([c],()=>V(),{name:"refresh_tick_ns",describeKind:"derived",initial:V(),meta:S("clock")}),v.add(E,{name:"refresh_tick_ns"})}let w;if(r){let n=[p.entries];E&&n.push(E),R&&n.push(R),w=x(n,c=>{let u=c[0],m;if(E){let M=c[1];m=typeof M=="number"?M:V()}else m=V();if(!u||u.size===0)return[];let h=[];for(let M of u.values())h.push({...M,score:ne(M.baseScore,re(m,M.lastAccessNs),d,f)});return h.sort((M,b)=>b.score-M.score||b.lastAccessNs-M.lastAccessNs),h},{name:"ranked",describeKind:"derived",equals:ge,meta:S("ranked")}),v.add(w,{name:"ranked"})}else w=Z([],{name:"ranked",describeKind:"state",meta:S("ranked_disabled")}),v.add(w,{name:"ranked"});let z=x([p.entries],([n])=>(n??new Map).size,{name:"size",describeKind:"derived",initial:0,meta:S("size")});v.add(z,{name:"size"}),v.addDisposer(I(z));let q=W({name:"events",retainedLimit:1024,graph:v}),K=J(v,"seq",0),O=(n,c,u)=>{let m=V(),h=p.get(n),M=u?.score??k()(c);p.set(n,{id:n,value:c,baseScore:M,createdAtNs:h?.createdAtNs??m,lastAccessNs:m})},G=n=>{p.has(n)&&p.delete(n)},j=()=>{p.size!==0&&p.clear()},D=()=>{if(!r)return;let n=k(),c=p.entries.cache;if(!c||c.size===0)return;let u=[];for(let m of c.values())u.push([m.id,{...m,baseScore:n(m.value)}]);p.setMany(u)},F=N(O,{audit:q,seq:K,onSuccess:([n],c,u)=>({action:"upsert",id:n,t_ns:u.t_ns,seq:u.seq})}),H=N(G,{audit:q,seq:K,onSuccess:([n],c,u)=>({action:"remove",id:n,t_ns:u.t_ns,seq:u.seq})}),i=N(j,{audit:q,seq:K,onSuccess:(n,c,u)=>({action:"clear",t_ns:u.t_ns,seq:u.seq})}),e=N(D,{audit:q,seq:K,onSuccess:(n,c,u)=>({action:"rescore",t_ns:u.t_ns,seq:u.seq})});function s(n){let c=$(n,"id");return x([p.entries,c],([u,m])=>u?.get(m),{describeKind:"derived",meta:S("collection_item")})}function a(n){let c=$(n,"id");return x([p.entries,c],([u,m])=>u?.has(m)??!1,{describeKind:"derived",meta:S("collection_has")})}return Object.assign(v,{events:q,items:p.entries,ranked:w,size:z,upsert:F,remove:H,clear:i,rescore:e,itemNode:s,hasNode:a})}function ye(o={}){let t=o.backend??"flat",g=o.dimension,r=o.strictDimension??!0,d=o.maxSize,f=o.retentionScore,l;if(t==="hnsw"&&(l=o.hnswFactory?.(),!l))throw new Error('vectorIndex backend "hnsw" requires an optional dependency adapter; install your HNSW package and provide `hnswFactory`.');let y=new P(o.name??"vector_index"),R;function k(e){if(g!==void 0){if(e.length!==g)throw new RangeError(`vector dimension mismatch: expected ${g}, got ${e.length}`);return}if(r){if(R===void 0){R=e.length;return}if(e.length!==R)throw new RangeError(`vector dimension mismatch: inferred ${R} from first upsert, got ${e.length}. Pass \`strictDimension: false\` to opt into zero-pad behavior, or set an explicit \`dimension\`.`)}}let v=f??(e=>e.upsertedAtNs),C=!1,p=W({name:"events",retainedLimit:1024,graph:y}),E=J(y,"seq",0),w=L({name:"entries",...d!==void 0?{retention:{score:(e,s)=>v(s),maxSize:d,onArchive:e=>{C||(t==="hnsw"&&l.remove(e),p.append({action:"evict",id:e,t_ns:X(),seq:ee(E)}))}}}:{}});if(y.add(w.entries,{name:"entries"}),y.addDisposer(I(w.entries)),l?.dispose){let e=l.dispose.bind(l);y.addDisposer(()=>e())}let z=(e,s,a)=>{k(s),t==="hnsw"&&l.upsert(e,s,a);let T=(()=>{if(a!==void 0)return a===null||typeof a!="object"?a:Array.isArray(a)?[...a]:{...a}})(),n={id:e,vector:[...s],...T!==void 0?{meta:T}:{},upsertedAtNs:V()};w.set(e,n)},q=e=>{w.has(e)&&(t==="hnsw"&&l.remove(e),w.delete(e))},K=()=>{if(w.size!==0){C=!0;try{w.clear(),t==="hnsw"&&l.clear()}finally{C=!1}R=void 0}},O=()=>{if(t!=="hnsw")return;let e=w.entries.cache;if(e){l.clear();for(let s of e.values())l.upsert(s.id,s.vector,s.meta)}},G=N(z,{audit:p,freeze:!1,seq:E,onSuccess:([e],s,a)=>({action:"upsert",id:e,t_ns:a.t_ns,seq:a.seq})}),j=N(q,{audit:p,seq:E,onSuccess:([e],s,a)=>({action:"remove",id:e,t_ns:a.t_ns,seq:a.seq})}),D=N(K,{audit:p,seq:E,onSuccess:(e,s,a)=>({action:"clear",t_ns:a.t_ns,seq:a.seq})}),F=N(O,{audit:p,seq:E,onSuccess:(e,s,a)=>({action:"reindex",t_ns:a.t_ns,seq:a.seq})});function H(e,s=5){let a=$(s,"k");return x([w.entries,e,a],T=>{let n=T[0],c=T[1],u=T[2],m=Number.isFinite(u)?Math.max(0,Math.floor(u)):0;if(!n||n.size===0||m<=0)return[];if(c==null||c.length===0)return[];let h=g??(r?R:void 0);return h!==void 0&&c.length!==h?[]:t==="hnsw"?[...l.search(c,m)]:[...n.values()].map(b=>({id:b.id,score:de(c,b.vector),...b.meta!==void 0?{meta:b.meta}:{}})).sort((b,A)=>A.score-b.score).slice(0,m)},{describeKind:"derived",equals:(T,n)=>ue(T,n),meta:S("vector_search")})}return Object.assign(y,{backend:t,events:p,entries:w.entries,upsert:G,remove:j,clear:D,reindex:F,searchNode:H})}var se="\0";function Q(o,t,g){return`${o}${se}${t}${se}${g}`}function ie(o,t){if(!o||o.size===0)return new Map;let g=new Map;for(let d of o.values()){let f=t==="from"?d.from:d.to,l=g.get(f);l||(l=[],g.set(f,l)),l.push(d)}let r=new Map;for(let[d,f]of g)r.set(d,Object.freeze(f));return r}function ae(o,t){if(o===t)return!0;if(o==null||t==null||o.size!==t.size)return!1;for(let[g,r]of o){let d=t.get(g);if(!d||r.length!==d.length)return!1;for(let f=0;f<r.length;f+=1){let l=r[f],y=d[f];if(l.from!==y.from||l.to!==y.to||l.relation!==y.relation||l.weight!==y.weight)return!1}}return!0}function me(o,t={}){let g=t.orphanGC??"keep";if(t.entitiesMaxSize!==void 0&&t.entitiesMaxSize<1)throw new RangeError("knowledgeGraph: entitiesMaxSize must be >= 1");if(t.edgesMaxSize!==void 0&&t.edgesMaxSize<1)throw new RangeError("knowledgeGraph: edgesMaxSize must be >= 1");let r=new P(o),d=L({name:"entities",...t.entitiesMaxSize!==void 0?{maxSize:t.entitiesMaxSize}:{}}),f=L({name:"edges",...t.edgesMaxSize!==void 0?{maxSize:t.edgesMaxSize}:{}});r.add(d.entries,{name:"entities"}),r.add(f.entries,{name:"edges"});let l=x([f.entries],([i])=>ie(i,"from"),{name:"adjacencyOut",describeKind:"derived",initial:new Map,equals:ae,meta:S("adjacency_out")}),y=x([f.entries],([i])=>ie(i,"to"),{name:"adjacencyIn",describeKind:"derived",initial:new Map,equals:ae,meta:S("adjacency_in")});r.add(l,{name:"adjacencyOut"}),r.add(y,{name:"adjacencyIn"}),r.addDisposer(I(l)),r.addDisposer(I(y));let R=x([d.entries],([i])=>(i??new Map).size,{name:"entityCount",describeKind:"derived",initial:0,meta:S("entity_count")}),k=x([f.entries],([i])=>(i??new Map).size,{name:"edgeCount",describeKind:"derived",initial:0,meta:S("edge_count")});r.add(R,{name:"entityCount"}),r.add(k,{name:"edgeCount"}),r.addDisposer(I(R)),r.addDisposer(I(k));let v=W({name:"events",retainedLimit:1024,graph:r}),C=J(r,"seq",0);function p(i){let e=l.cache,s=y.cache;return(e?.get(i)?.length??0)>0||(s?.get(i)?.length??0)>0}function E(i){if(g==="remove")for(let e of i)d.has(e)&&(p(e)||(d.delete(e),v.append({action:"orphanRemove",id:e,t_ns:X(),seq:ee(C)})))}let w=(i,e)=>{d.set(i,e)},z=i=>{let e=f.entries.cache,s=new Set;if(e){let a=[];for(let[T,n]of e)(n.from===i||n.to===i)&&(a.push(T),n.from!==i&&s.add(n.from),n.to!==i&&s.add(n.to));a.length>0&&f.deleteMany(a)}d.has(i)&&d.delete(i),E([...s])},q=(i,e,s,a=1)=>{f.set(Q(i,e,s),{from:i,to:e,relation:s,weight:a})},K=(i,e,s)=>{if(s!==void 0)f.delete(Q(i,e,s));else{let a=f.entries.cache;if(!a)return;let T=[];for(let[n,c]of a)c.from===i&&c.to===e&&T.push(n);T.length>0&&f.deleteMany(T)}E([i,e])},O=N(w,{audit:v,seq:C,onSuccess:([i],e,s)=>({action:"upsertEntity",id:i,t_ns:s.t_ns,seq:s.seq})}),G=N(z,{audit:v,seq:C,onSuccess:([i],e,s)=>({action:"removeEntity",id:i,t_ns:s.t_ns,seq:s.seq})}),j=N(q,{audit:v,seq:C,onSuccess:([i,e,s,a],T,n)=>({action:"link",from:i,to:e,relation:s,weight:a??1,t_ns:n.t_ns,seq:n.seq})}),D=N(K,{audit:v,seq:C,onSuccess:([i,e,s],a,T)=>({action:"unlink",from:i,to:e,...s!==void 0?{relation:s}:{},t_ns:T.t_ns,seq:T.seq})});function F(i,e){let s=$(i,"id"),a=e!==void 0?$(e,"relation"):void 0;return x(a?[l,y,s,a]:[l,y,s],n=>{let c=n[0],u=n[1],m=n[2],h=a?n[3]:void 0,M=c.get(m)??[],b=u.get(m)??[],A=new Set,U=[];for(let _ of M){let B=Q(_.from,_.to,_.relation);A.has(B)||h!==void 0&&_.relation!==h||(A.add(B),U.push(_))}for(let _ of b){let B=Q(_.from,_.to,_.relation);A.has(B)||h!==void 0&&_.relation!==h||(A.add(B),U.push(_))}return U},{describeKind:"derived",equals:(n,c)=>{let u=n,m=c;if(u===m)return!0;if(u==null||m==null||u.length!==m.length)return!1;for(let h=0;h<u.length;h+=1){let M=u[h],b=m[h];if(M.from!==b.from||M.to!==b.to||M.relation!==b.relation||M.weight!==b.weight)return!1}return!0},meta:S("related")})}return Object.assign(r,{events:v,entities:d.entries,edges:f.entries,adjacencyOut:l,adjacencyIn:y,entityCount:R,edgeCount:k,upsertEntity:O,removeEntity:G,link:j,unlink:D,relatedNode:F})}export{de as a,fe as b,ye as c,me as d,pe as e};
|
|
1
|
+
import{b as ne}from"./chunk-TSOYJ743.js";import{c as W,d as ee,f as N,h as J}from"./chunk-FDQGFWLF.js";import{a as te}from"./chunk-L6NSJVJZ.js";import{j as P}from"./chunk-626TESAC.js";import{b as L}from"./chunk-TZQPPQEQ.js";import{C as I,f as oe}from"./chunk-V5A7M7RJ.js";import{C as Y,E as Z,G as x,o as V,p as X}from"./chunk-LYCLF26R.js";import{b as ce}from"./chunk-QYADASLV.js";var pe={};ce(pe,{collection:()=>fe,cosineSimilarity:()=>de,knowledgeGraph:()=>me,vectorIndex:()=>ye});var le=1e9;function S(o,t){return te("memory",o,t)}function $(o,t){return o instanceof Y?o:Z(o,t?{name:t}:void 0)}function re(o,t){return(o-t)/le}function de(o,t){let g=Math.max(o.length,t.length),r=0,d=0,f=0;for(let y=0;y<g;y+=1){let R=o[y]??0,k=t[y]??0;r+=R*k,d+=R*R,f+=k*k}if(d===0||f===0)return 0;let l=r/Math.sqrt(d*f);return Number.isFinite(l)?l:0}function ue(o,t){if(o===t)return!0;if(o==null||t==null||o.length!==t.length)return!1;for(let g=0;g<o.length;g+=1){let r=o[g],d=t[g];if(r.id!==d.id||r.score!==d.score||r.meta!==d.meta)return!1}return!0}function ge(o,t){if(o===t)return!0;if(o==null||t==null||o.length!==t.length)return!1;for(let g=0;g<o.length;g+=1){let r=o[g],d=t[g];if(r.id!==d.id||r.score!==d.score||r.lastAccessNs!==d.lastAccessNs||r.value!==d.value)return!1}return!0}function fe(o,t={}){let g=t.maxSize,r=t.ranked??!0,d=r?t.decayRate??0:0,f=t.minScore??0;if(g!==void 0&&g<1)throw new RangeError("collection: maxSize must be >= 1");let l=()=>r?1:0,y=t.score??l,R=r&&y instanceof Y?y:void 0,k=()=>R?R.cache??l:y,v=new P(o),p=L({name:"items",...g!==void 0?{retention:{score:(n,c)=>r?ne(c.baseScore,re(V(),c.lastAccessNs),d,f):c.lastAccessNs,maxSize:g}}:{}});v.add(p.entries,{name:"items"});let E;if(r&&d>0){let n=t.refreshIntervalMs??Math.max(1,1e3*Math.LN2/(10*d)),c=oe(n,{period:n});E=x([c],()=>V(),{name:"refresh_tick_ns",describeKind:"derived",initial:V(),meta:S("clock")}),v.add(E,{name:"refresh_tick_ns"})}let w;if(r){let n=[p.entries];E&&n.push(E),R&&n.push(R),w=x(n,c=>{let u=c[0],m;if(E){let M=c[1];m=typeof M=="number"?M:V()}else m=V();if(!u||u.size===0)return[];let h=[];for(let M of u.values())h.push({...M,score:ne(M.baseScore,re(m,M.lastAccessNs),d,f)});return h.sort((M,b)=>b.score-M.score||b.lastAccessNs-M.lastAccessNs),h},{name:"ranked",describeKind:"derived",equals:ge,meta:S("ranked")}),v.add(w,{name:"ranked"})}else w=Z([],{name:"ranked",describeKind:"state",meta:S("ranked_disabled")}),v.add(w,{name:"ranked"});let z=x([p.entries],([n])=>(n??new Map).size,{name:"size",describeKind:"derived",initial:0,meta:S("size")});v.add(z,{name:"size"}),v.addDisposer(I(z));let q=W({name:"events",retainedLimit:1024,graph:v}),K=J(v,"seq",0),O=(n,c,u)=>{let m=V(),h=p.get(n),M=u?.score??k()(c);p.set(n,{id:n,value:c,baseScore:M,createdAtNs:h?.createdAtNs??m,lastAccessNs:m})},G=n=>{p.has(n)&&p.delete(n)},j=()=>{p.size!==0&&p.clear()},D=()=>{if(!r)return;let n=k(),c=p.entries.cache;if(!c||c.size===0)return;let u=[];for(let m of c.values())u.push([m.id,{...m,baseScore:n(m.value)}]);p.setMany(u)},F=N(O,{audit:q,seq:K,onSuccess:([n],c,u)=>({action:"upsert",id:n,t_ns:u.t_ns,seq:u.seq})}),H=N(G,{audit:q,seq:K,onSuccess:([n],c,u)=>({action:"remove",id:n,t_ns:u.t_ns,seq:u.seq})}),i=N(j,{audit:q,seq:K,onSuccess:(n,c,u)=>({action:"clear",t_ns:u.t_ns,seq:u.seq})}),e=N(D,{audit:q,seq:K,onSuccess:(n,c,u)=>({action:"rescore",t_ns:u.t_ns,seq:u.seq})});function s(n){let c=$(n,"id");return x([p.entries,c],([u,m])=>u?.get(m),{describeKind:"derived",meta:S("collection_item")})}function a(n){let c=$(n,"id");return x([p.entries,c],([u,m])=>u?.has(m)??!1,{describeKind:"derived",meta:S("collection_has")})}return Object.assign(v,{events:q,items:p.entries,ranked:w,size:z,upsert:F,remove:H,clear:i,rescore:e,itemNode:s,hasNode:a})}function ye(o={}){let t=o.backend??"flat",g=o.dimension,r=o.strictDimension??!0,d=o.maxSize,f=o.retentionScore,l;if(t==="hnsw"&&(l=o.hnswFactory?.(),!l))throw new Error('vectorIndex backend "hnsw" requires an optional dependency adapter; install your HNSW package and provide `hnswFactory`.');let y=new P(o.name??"vector_index"),R;function k(e){if(g!==void 0){if(e.length!==g)throw new RangeError(`vector dimension mismatch: expected ${g}, got ${e.length}`);return}if(r){if(R===void 0){R=e.length;return}if(e.length!==R)throw new RangeError(`vector dimension mismatch: inferred ${R} from first upsert, got ${e.length}. Pass \`strictDimension: false\` to opt into zero-pad behavior, or set an explicit \`dimension\`.`)}}let v=f??(e=>e.upsertedAtNs),C=!1,p=W({name:"events",retainedLimit:1024,graph:y}),E=J(y,"seq",0),w=L({name:"entries",...d!==void 0?{retention:{score:(e,s)=>v(s),maxSize:d,onArchive:e=>{C||(t==="hnsw"&&l.remove(e),p.append({action:"evict",id:e,t_ns:X(),seq:ee(E)}))}}}:{}});if(y.add(w.entries,{name:"entries"}),y.addDisposer(I(w.entries)),l?.dispose){let e=l.dispose.bind(l);y.addDisposer(()=>e())}let z=(e,s,a)=>{k(s),t==="hnsw"&&l.upsert(e,s,a);let T=(()=>{if(a!==void 0)return a===null||typeof a!="object"?a:Array.isArray(a)?[...a]:{...a}})(),n={id:e,vector:[...s],...T!==void 0?{meta:T}:{},upsertedAtNs:V()};w.set(e,n)},q=e=>{w.has(e)&&(t==="hnsw"&&l.remove(e),w.delete(e))},K=()=>{if(w.size!==0){C=!0;try{w.clear(),t==="hnsw"&&l.clear()}finally{C=!1}R=void 0}},O=()=>{if(t!=="hnsw")return;let e=w.entries.cache;if(e){l.clear();for(let s of e.values())l.upsert(s.id,s.vector,s.meta)}},G=N(z,{audit:p,freeze:!1,seq:E,onSuccess:([e],s,a)=>({action:"upsert",id:e,t_ns:a.t_ns,seq:a.seq})}),j=N(q,{audit:p,seq:E,onSuccess:([e],s,a)=>({action:"remove",id:e,t_ns:a.t_ns,seq:a.seq})}),D=N(K,{audit:p,seq:E,onSuccess:(e,s,a)=>({action:"clear",t_ns:a.t_ns,seq:a.seq})}),F=N(O,{audit:p,seq:E,onSuccess:(e,s,a)=>({action:"reindex",t_ns:a.t_ns,seq:a.seq})});function H(e,s=5){let a=$(s,"k");return x([w.entries,e,a],T=>{let n=T[0],c=T[1],u=T[2],m=Number.isFinite(u)?Math.max(0,Math.floor(u)):0;if(!n||n.size===0||m<=0)return[];if(c==null||c.length===0)return[];let h=g??(r?R:void 0);return h!==void 0&&c.length!==h?[]:t==="hnsw"?[...l.search(c,m)]:[...n.values()].map(b=>({id:b.id,score:de(c,b.vector),...b.meta!==void 0?{meta:b.meta}:{}})).sort((b,A)=>A.score-b.score).slice(0,m)},{describeKind:"derived",equals:(T,n)=>ue(T,n),meta:S("vector_search")})}return Object.assign(y,{backend:t,events:p,entries:w.entries,upsert:G,remove:j,clear:D,reindex:F,searchNode:H})}var se="\0";function Q(o,t,g){return`${o}${se}${t}${se}${g}`}function ie(o,t){if(!o||o.size===0)return new Map;let g=new Map;for(let d of o.values()){let f=t==="from"?d.from:d.to,l=g.get(f);l||(l=[],g.set(f,l)),l.push(d)}let r=new Map;for(let[d,f]of g)r.set(d,Object.freeze(f));return r}function ae(o,t){if(o===t)return!0;if(o==null||t==null||o.size!==t.size)return!1;for(let[g,r]of o){let d=t.get(g);if(!d||r.length!==d.length)return!1;for(let f=0;f<r.length;f+=1){let l=r[f],y=d[f];if(l.from!==y.from||l.to!==y.to||l.relation!==y.relation||l.weight!==y.weight)return!1}}return!0}function me(o,t={}){let g=t.orphanGC??"keep";if(t.entitiesMaxSize!==void 0&&t.entitiesMaxSize<1)throw new RangeError("knowledgeGraph: entitiesMaxSize must be >= 1");if(t.edgesMaxSize!==void 0&&t.edgesMaxSize<1)throw new RangeError("knowledgeGraph: edgesMaxSize must be >= 1");let r=new P(o),d=L({name:"entities",...t.entitiesMaxSize!==void 0?{maxSize:t.entitiesMaxSize}:{}}),f=L({name:"edges",...t.edgesMaxSize!==void 0?{maxSize:t.edgesMaxSize}:{}});r.add(d.entries,{name:"entities"}),r.add(f.entries,{name:"edges"});let l=x([f.entries],([i])=>ie(i,"from"),{name:"adjacencyOut",describeKind:"derived",initial:new Map,equals:ae,meta:S("adjacency_out")}),y=x([f.entries],([i])=>ie(i,"to"),{name:"adjacencyIn",describeKind:"derived",initial:new Map,equals:ae,meta:S("adjacency_in")});r.add(l,{name:"adjacencyOut"}),r.add(y,{name:"adjacencyIn"}),r.addDisposer(I(l)),r.addDisposer(I(y));let R=x([d.entries],([i])=>(i??new Map).size,{name:"entityCount",describeKind:"derived",initial:0,meta:S("entity_count")}),k=x([f.entries],([i])=>(i??new Map).size,{name:"edgeCount",describeKind:"derived",initial:0,meta:S("edge_count")});r.add(R,{name:"entityCount"}),r.add(k,{name:"edgeCount"}),r.addDisposer(I(R)),r.addDisposer(I(k));let v=W({name:"events",retainedLimit:1024,graph:r}),C=J(r,"seq",0);function p(i){let e=l.cache,s=y.cache;return(e?.get(i)?.length??0)>0||(s?.get(i)?.length??0)>0}function E(i){if(g==="remove")for(let e of i)d.has(e)&&(p(e)||(d.delete(e),v.append({action:"orphanRemove",id:e,t_ns:X(),seq:ee(C)})))}let w=(i,e)=>{d.set(i,e)},z=i=>{let e=f.entries.cache,s=new Set;if(e){let a=[];for(let[T,n]of e)(n.from===i||n.to===i)&&(a.push(T),n.from!==i&&s.add(n.from),n.to!==i&&s.add(n.to));a.length>0&&f.deleteMany(a)}d.has(i)&&d.delete(i),E([...s])},q=(i,e,s,a=1)=>{f.set(Q(i,e,s),{from:i,to:e,relation:s,weight:a})},K=(i,e,s)=>{if(s!==void 0)f.delete(Q(i,e,s));else{let a=f.entries.cache;if(!a)return;let T=[];for(let[n,c]of a)c.from===i&&c.to===e&&T.push(n);T.length>0&&f.deleteMany(T)}E([i,e])},O=N(w,{audit:v,seq:C,onSuccess:([i],e,s)=>({action:"upsertEntity",id:i,t_ns:s.t_ns,seq:s.seq})}),G=N(z,{audit:v,seq:C,onSuccess:([i],e,s)=>({action:"removeEntity",id:i,t_ns:s.t_ns,seq:s.seq})}),j=N(q,{audit:v,seq:C,onSuccess:([i,e,s,a],T,n)=>({action:"link",from:i,to:e,relation:s,weight:a??1,t_ns:n.t_ns,seq:n.seq})}),D=N(K,{audit:v,seq:C,onSuccess:([i,e,s],a,T)=>({action:"unlink",from:i,to:e,...s!==void 0?{relation:s}:{},t_ns:T.t_ns,seq:T.seq})});function F(i,e){let s=$(i,"id"),a=e!==void 0?$(e,"relation"):void 0;return x(a?[l,y,s,a]:[l,y,s],n=>{let c=n[0],u=n[1],m=n[2],h=a?n[3]:void 0,M=c.get(m)??[],b=u.get(m)??[],A=new Set,U=[];for(let _ of M){let B=Q(_.from,_.to,_.relation);A.has(B)||h!==void 0&&_.relation!==h||(A.add(B),U.push(_))}for(let _ of b){let B=Q(_.from,_.to,_.relation);A.has(B)||h!==void 0&&_.relation!==h||(A.add(B),U.push(_))}return U},{describeKind:"derived",equals:(n,c)=>{let u=n,m=c;if(u===m)return!0;if(u==null||m==null||u.length!==m.length)return!1;for(let h=0;h<u.length;h+=1){let M=u[h],b=m[h];if(M.from!==b.from||M.to!==b.to||M.relation!==b.relation||M.weight!==b.weight)return!1}return!0},meta:S("related")})}return Object.assign(r,{events:v,entities:d.entries,edges:f.entries,adjacencyOut:l,adjacencyIn:y,entityCount:R,edgeCount:k,upsertEntity:O,removeEntity:G,link:j,unlink:D,relatedNode:F})}export{de as a,fe as b,ye as c,me as d,pe as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{j as f}from"./chunk-626TESAC.js";import{E as d}from"./chunk-LYCLF26R.js";import{b as S}from"./chunk-CK2E7BTU.js";import{b}from"./chunk-QYADASLV.js";var g={};b(g,{create:()=>v});var m=()=>!1;function v(l){let o=new f("zustand"),t=d(void 0,{name:"state",equals:m});o.add(t,{name:"state"});let r=()=>t.cache,n=(e,s)=>{let a=t.cache,i=typeof e=="function"?e(a):e;t.emit(s?i:{...a,...i})},c={getState:r,setState:n,getInitialState:()=>T,subscribe:e=>{let s=!0,a=t.cache;return t.subscribe(i=>{for(let[u,p]of i)if(u===S){if(s){s=!1;continue}e(p,a),a=p}})},destroy:o.destroy.bind(o)},T=l(n,r,c);return t.emit(T),Object.assign(o,c)}export{v as a,g as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as w,E as I,F as b,p as C}from"./chunk-LYCLF26R.js";import{a as S,b as h,c as A,d as x,i as T,j as p}from"./chunk-CK2E7BTU.js";function y(e,n,t){let u=new Set;for(let o of e.split(",")){let[r,i]=o.split("/"),s=i?Number.parseInt(i,10):1;if(Number.isNaN(s)||s<1)throw new Error(`Invalid cron step: ${o}`);let a,d;if(r==="*")a=n,d=t;else if(r.includes("-")){let[f,c]=r.split("-");a=Number.parseInt(f,10),d=Number.parseInt(c,10)}else a=Number.parseInt(r,10),d=a;if(Number.isNaN(a)||Number.isNaN(d))throw new Error(`Invalid cron field: ${e}`);if(a<n||d>t)throw new Error(`Cron field out of range: ${e} (${n}-${t})`);if(a>d)throw new Error(`Invalid cron range: ${a}-${d} in ${e}`);for(let f=a;f<=d;f+=s)u.add(f)}return u}function L(e){let n=e.trim().split(/\s+/);if(n.length!==5)throw new Error(`Invalid cron: expected 5 fields, got ${n.length}`);return{minutes:y(n[0],0,59),hours:y(n[1],0,23),daysOfMonth:y(n[2],1,31),months:y(n[3],1,12),daysOfWeek:y(n[4],0,6)}}function P(e,n){return e.minutes.has(n.getMinutes())&&e.hours.has(n.getHours())&&e.daysOfMonth.has(n.getDate())&&e.months.has(n.getMonth()+1)&&e.daysOfWeek.has(n.getDay())}function m(e){return{describeKind:"producer",...e}}function $(e){return/[\\^$+?.()|[\]{}]/.test(e)?`\\${e}`:e}function X(e){let n="^";for(let t=0;t<e.length;t+=1){let u=e[t];if(u==="*"){e[t+1]==="*"?(n+=".*",t+=1):n+="[^/]*";continue}n+=$(u)}return n+="$",new RegExp(n)}function Z(e,n){for(let t of n)if(t.test(e))return!0;return!1}function K(e,n){let t=w([e],(o,r)=>{let i=o[0];if(i==null||i.length===0){r.down([[x]]);return}for(let s of i)r.emit(s)},{describeKind:"derived",initial:e.cache}),u=t.subscribe.bind(t);return t.subscribe=(o,r)=>(n(o),u(o,r)),t}function ee(e,n){let{signal:t,period:u,...o}=n??{};return b(r=>{let i=!1,s=0,a,d,f=()=>{i=!0,a!==void 0&&clearTimeout(a),d!==void 0&&clearInterval(d),t?.removeEventListener("abort",l)},c=()=>{i||(u!=null?(r.emit(s++),d=setInterval(()=>{i||r.emit(s++)},u)):(i=!0,t?.removeEventListener("abort",l),r.emit(s++),r.down([[T]])))},l=()=>{i||(f(),r.down([[p,t.reason]]))};if(t?.aborted){l();return}return a=setTimeout(c,e),t?.addEventListener("abort",l,{once:!0}),f},m(o))}function ne(e){let{signal:n,...t}=e??{};return b(u=>{let o=!1,r,i,s=!1,a=!1,d=typeof requestAnimationFrame=="function"?requestAnimationFrame:void 0,f=typeof cancelAnimationFrame=="function"?cancelAnimationFrame:void 0,c=typeof document<"u"?document:void 0,l=()=>{r!==void 0&&f&&f(r),i!==void 0&&clearTimeout(i),r=void 0,i=void 0},v=()=>{o=!0,l(),s&&(n?.removeEventListener("abort",N),s=!1),a&&c&&(c.removeEventListener("visibilitychange",k),a=!1)},N=()=>{o||(v(),u.down([[p,n.reason]]))},O=_=>{o||(u.emit(_),g())},g=()=>{o||(d&&(!c||c.visibilityState!=="hidden")?r=d(O):i=setTimeout(()=>O(performance.now()),16))},k=()=>{o||(l(),g())};return n?.aborted?(N(),v):(n?.addEventListener("abort",N,{once:!0}),s=n!==void 0,c&&d&&(c.addEventListener("visibilitychange",k),a=!0),g(),v)},m(t))}function te(e,n){let t=L(e),{tickMs:u,output:o,...r}=n??{},i=u??6e4,s=o==="date";return b(a=>{let d=-1,f=()=>{let l=new Date,v=l.getFullYear()*1e8+(l.getMonth()+1)*1e6+l.getDate()*1e4+l.getHours()*100+l.getMinutes();v!==d&&P(t,l)&&(d=v,a.emit(s?l:C()))};f();let c=setInterval(f,i);return()=>clearInterval(c)},{...m(r),name:r.name??`cron:${e}`})}function re(e,n,t){let{capture:u,passive:o,once:r,...i}=t??{};return b(s=>{let a=f=>{s.emit(f)},d={capture:u,passive:o,once:r};return e.addEventListener(n,a,d),()=>e.removeEventListener(n,a,d)},m(i))}function D(e,n){return b(t=>{let u=!1;try{for(let o of e){if(u)return;t.emit(o)}u||t.down([[T]])}catch(o){u||t.down([[p,o]])}return()=>{u=!0}},m(n))}function W(e){return e!=null&&typeof e.then=="function"}function q(e,n){let{signal:t,...u}=n??{};return b(o=>{let r=!1,i=()=>{r||(r=!0,o.down([[p,t.reason]]))};if(t?.aborted){i();return}return t?.addEventListener("abort",i,{once:!0}),Promise.resolve(e).then(s=>{r||(r=!0,t?.removeEventListener("abort",i),o.emit(s),o.down([[T]]))},s=>{r||(r=!0,t?.removeEventListener("abort",i),o.down([[p,s]]))}),()=>{r=!0,t?.removeEventListener("abort",i)}},m(u))}function H(e,n){let{signal:t,...u}=n??{};return b(o=>{let r=new AbortController,i=()=>r.abort(t?.reason);t?.aborted?r.abort(t.reason):t?.addEventListener("abort",i,{once:!0});let s=t??r.signal,a=!1,d=e[Symbol.asyncIterator](),f=()=>{a||s.aborted||Promise.resolve(d.next()).then(c=>{if(!(a||s.aborted)){if(c.done){o.down([[T]]);return}o.emit(c.value),f()}},c=>{!a&&!s.aborted&&o.down([[p,c]])})};return f(),()=>{a=!0,t?.removeEventListener("abort",i),r.abort(),Promise.resolve(d.return?.()).catch(()=>{})}},m(u))}function U(e){return e!=null&&typeof e=="object"&&"cache"in e&&typeof e.subscribe=="function"}function V(e,n){if(U(e))return e;if(W(e))return q(e,n);if(e!=null){let t=e;if(typeof t[Symbol.asyncIterator]=="function")return H(e,n);if(typeof t[Symbol.iterator]=="function")return D(e,n)}return B(e)}function B(...e){return D(e,void 0)}function oe(e){return b(n=>{n.down([[T]])},m(e))}function ie(e){return b(()=>{},m(e))}function se(e,n){return b(t=>{t.down([[p,e]])},m(n))}function ue(e,n){let{signal:t,...u}=n??{},o=m(u),r=o.resubscribable===void 0?{...o,resubscribable:!0}:o;return b(i=>{let s,a=!1;try{let d=e();s=V(d,n).subscribe(c=>{if(!a)for(let l of c){let v=l[0];if(v!==S)if(v===h)i.emit(l[1]);else if(v===T){a=!0,i.down([[T]]);break}else if(v===p){a=!0,i.down([[p,l[1]]]);break}else i.down([l])}})}catch(d){let f=d===void 0?new Error("defer: thunk threw undefined"):d;i.down([[p,f]])}return()=>{a=!0,s?.()}},r)}function ae(e,n,t){return w([e],(o,r)=>{let i=o[0];if(i!=null&&i.length>0)for(let s of i)n(s)},{describeKind:"effect",...t}).subscribe(()=>{})}function de(e,n){return w([e],(t,u,o)=>{o.store.buf||(o.store.buf=[]);let r=o.store.buf,i=t[0];if(i!=null&&i.length>0)for(let s of i)r.push(s);if(o.terminalDeps[0]===!0){u.emit([...r]),u.down([[T]]);return}(i==null||i.length===0)&&u.down([[x]])},{describeKind:"derived",completeWhenDepsComplete:!1,...n})}function fe(e,n){return b(t=>e.subscribe(u=>{t.down(u)}),{...m(n),initial:e.cache})}function F(e,n,t){if(n<1)throw new RangeError("replay expects bufferSize >= 1");let u=[],o=b(r=>e.subscribe(i=>{for(let s of i)s[0]===h&&(u.push(s[1]),u.length>n&&u.shift());r.down(i)}),{...m(t),initial:e.cache});return K(o,r=>{for(let i of u)r([[h,i]])})}function ce(e,n){return F(e,1,n)}function le(e){return new Promise((n,t)=>{let u=!1,o=!1,r;r=e.subscribe(i=>{for(let s of i){if(u)return;if(s[0]===h){u=!0,n(s[1]),r?(r(),r=void 0):o=!0;return}if(s[0]===p){u=!0,t(s[1]),r?(r(),r=void 0):o=!0;return}if(s[0]===T){u=!0,t(new Error("completed without DATA")),r?(r(),r=void 0):o=!0;return}}}),o&&(r?.(),r=void 0)})}function R(e,n,t){return new Promise((u,o)=>{let r=!1,i=!1,s,a=t?.skipCurrent===!0;s=e.subscribe(d=>{for(let f of d){if(r)return;if(!(a&&f[0]===h)){if(f[0]===h){let c=f[1];if(n(c)){r=!0,u(c),s?(s(),s=void 0):i=!0;return}}if(f[0]===p){r=!0,o(f[1]),s?(s(),s=void 0):i=!0;return}if(f[0]===T){r=!0,o(new Error("completed without matching value")),s?(s(),s=void 0):i=!0;return}}}}),a=!1,i&&(s?.(),s=void 0)})}var E,M;async function pe(e,n){let t=n?.predicate??(r=>r!=null),u=n?.skipCurrent;if(n?.timeoutMs==null||n.timeoutMs<=0)return await R(e,t,{skipCurrent:u});if(E===void 0){let[r,i]=await Promise.all([import("./resilience-
|
|
1
|
+
import{D as w,E as I,F as b,p as C}from"./chunk-LYCLF26R.js";import{a as S,b as h,c as A,d as x,i as T,j as p}from"./chunk-CK2E7BTU.js";function y(e,n,t){let u=new Set;for(let o of e.split(",")){let[r,i]=o.split("/"),s=i?Number.parseInt(i,10):1;if(Number.isNaN(s)||s<1)throw new Error(`Invalid cron step: ${o}`);let a,d;if(r==="*")a=n,d=t;else if(r.includes("-")){let[f,c]=r.split("-");a=Number.parseInt(f,10),d=Number.parseInt(c,10)}else a=Number.parseInt(r,10),d=a;if(Number.isNaN(a)||Number.isNaN(d))throw new Error(`Invalid cron field: ${e}`);if(a<n||d>t)throw new Error(`Cron field out of range: ${e} (${n}-${t})`);if(a>d)throw new Error(`Invalid cron range: ${a}-${d} in ${e}`);for(let f=a;f<=d;f+=s)u.add(f)}return u}function L(e){let n=e.trim().split(/\s+/);if(n.length!==5)throw new Error(`Invalid cron: expected 5 fields, got ${n.length}`);return{minutes:y(n[0],0,59),hours:y(n[1],0,23),daysOfMonth:y(n[2],1,31),months:y(n[3],1,12),daysOfWeek:y(n[4],0,6)}}function P(e,n){return e.minutes.has(n.getMinutes())&&e.hours.has(n.getHours())&&e.daysOfMonth.has(n.getDate())&&e.months.has(n.getMonth()+1)&&e.daysOfWeek.has(n.getDay())}function m(e){return{describeKind:"producer",...e}}function $(e){return/[\\^$+?.()|[\]{}]/.test(e)?`\\${e}`:e}function X(e){let n="^";for(let t=0;t<e.length;t+=1){let u=e[t];if(u==="*"){e[t+1]==="*"?(n+=".*",t+=1):n+="[^/]*";continue}n+=$(u)}return n+="$",new RegExp(n)}function Z(e,n){for(let t of n)if(t.test(e))return!0;return!1}function K(e,n){let t=w([e],(o,r)=>{let i=o[0];if(i==null||i.length===0){r.down([[x]]);return}for(let s of i)r.emit(s)},{describeKind:"derived",initial:e.cache}),u=t.subscribe.bind(t);return t.subscribe=(o,r)=>(n(o),u(o,r)),t}function ee(e,n){let{signal:t,period:u,...o}=n??{};return b(r=>{let i=!1,s=0,a,d,f=()=>{i=!0,a!==void 0&&clearTimeout(a),d!==void 0&&clearInterval(d),t?.removeEventListener("abort",l)},c=()=>{i||(u!=null?(r.emit(s++),d=setInterval(()=>{i||r.emit(s++)},u)):(i=!0,t?.removeEventListener("abort",l),r.emit(s++),r.down([[T]])))},l=()=>{i||(f(),r.down([[p,t.reason]]))};if(t?.aborted){l();return}return a=setTimeout(c,e),t?.addEventListener("abort",l,{once:!0}),f},m(o))}function ne(e){let{signal:n,...t}=e??{};return b(u=>{let o=!1,r,i,s=!1,a=!1,d=typeof requestAnimationFrame=="function"?requestAnimationFrame:void 0,f=typeof cancelAnimationFrame=="function"?cancelAnimationFrame:void 0,c=typeof document<"u"?document:void 0,l=()=>{r!==void 0&&f&&f(r),i!==void 0&&clearTimeout(i),r=void 0,i=void 0},v=()=>{o=!0,l(),s&&(n?.removeEventListener("abort",N),s=!1),a&&c&&(c.removeEventListener("visibilitychange",k),a=!1)},N=()=>{o||(v(),u.down([[p,n.reason]]))},O=_=>{o||(u.emit(_),g())},g=()=>{o||(d&&(!c||c.visibilityState!=="hidden")?r=d(O):i=setTimeout(()=>O(performance.now()),16))},k=()=>{o||(l(),g())};return n?.aborted?(N(),v):(n?.addEventListener("abort",N,{once:!0}),s=n!==void 0,c&&d&&(c.addEventListener("visibilitychange",k),a=!0),g(),v)},m(t))}function te(e,n){let t=L(e),{tickMs:u,output:o,...r}=n??{},i=u??6e4,s=o==="date";return b(a=>{let d=-1,f=()=>{let l=new Date,v=l.getFullYear()*1e8+(l.getMonth()+1)*1e6+l.getDate()*1e4+l.getHours()*100+l.getMinutes();v!==d&&P(t,l)&&(d=v,a.emit(s?l:C()))};f();let c=setInterval(f,i);return()=>clearInterval(c)},{...m(r),name:r.name??`cron:${e}`})}function re(e,n,t){let{capture:u,passive:o,once:r,...i}=t??{};return b(s=>{let a=f=>{s.emit(f)},d={capture:u,passive:o,once:r};return e.addEventListener(n,a,d),()=>e.removeEventListener(n,a,d)},m(i))}function D(e,n){return b(t=>{let u=!1;try{for(let o of e){if(u)return;t.emit(o)}u||t.down([[T]])}catch(o){u||t.down([[p,o]])}return()=>{u=!0}},m(n))}function W(e){return e!=null&&typeof e.then=="function"}function q(e,n){let{signal:t,...u}=n??{};return b(o=>{let r=!1,i=()=>{r||(r=!0,o.down([[p,t.reason]]))};if(t?.aborted){i();return}return t?.addEventListener("abort",i,{once:!0}),Promise.resolve(e).then(s=>{r||(r=!0,t?.removeEventListener("abort",i),o.emit(s),o.down([[T]]))},s=>{r||(r=!0,t?.removeEventListener("abort",i),o.down([[p,s]]))}),()=>{r=!0,t?.removeEventListener("abort",i)}},m(u))}function H(e,n){let{signal:t,...u}=n??{};return b(o=>{let r=new AbortController,i=()=>r.abort(t?.reason);t?.aborted?r.abort(t.reason):t?.addEventListener("abort",i,{once:!0});let s=t??r.signal,a=!1,d=e[Symbol.asyncIterator](),f=()=>{a||s.aborted||Promise.resolve(d.next()).then(c=>{if(!(a||s.aborted)){if(c.done){o.down([[T]]);return}o.emit(c.value),f()}},c=>{!a&&!s.aborted&&o.down([[p,c]])})};return f(),()=>{a=!0,t?.removeEventListener("abort",i),r.abort(),Promise.resolve(d.return?.()).catch(()=>{})}},m(u))}function U(e){return e!=null&&typeof e=="object"&&"cache"in e&&typeof e.subscribe=="function"}function V(e,n){if(U(e))return e;if(W(e))return q(e,n);if(e!=null){let t=e;if(typeof t[Symbol.asyncIterator]=="function")return H(e,n);if(typeof t[Symbol.iterator]=="function")return D(e,n)}return B(e)}function B(...e){return D(e,void 0)}function oe(e){return b(n=>{n.down([[T]])},m(e))}function ie(e){return b(()=>{},m(e))}function se(e,n){return b(t=>{t.down([[p,e]])},m(n))}function ue(e,n){let{signal:t,...u}=n??{},o=m(u),r=o.resubscribable===void 0?{...o,resubscribable:!0}:o;return b(i=>{let s,a=!1;try{let d=e();s=V(d,n).subscribe(c=>{if(!a)for(let l of c){let v=l[0];if(v!==S)if(v===h)i.emit(l[1]);else if(v===T){a=!0,i.down([[T]]);break}else if(v===p){a=!0,i.down([[p,l[1]]]);break}else i.down([l])}})}catch(d){let f=d===void 0?new Error("defer: thunk threw undefined"):d;i.down([[p,f]])}return()=>{a=!0,s?.()}},r)}function ae(e,n,t){return w([e],(o,r)=>{let i=o[0];if(i!=null&&i.length>0)for(let s of i)n(s)},{describeKind:"effect",...t}).subscribe(()=>{})}function de(e,n){return w([e],(t,u,o)=>{o.store.buf||(o.store.buf=[]);let r=o.store.buf,i=t[0];if(i!=null&&i.length>0)for(let s of i)r.push(s);if(o.terminalDeps[0]===!0){u.emit([...r]),u.down([[T]]);return}(i==null||i.length===0)&&u.down([[x]])},{describeKind:"derived",completeWhenDepsComplete:!1,...n})}function fe(e,n){return b(t=>e.subscribe(u=>{t.down(u)}),{...m(n),initial:e.cache})}function F(e,n,t){if(n<1)throw new RangeError("replay expects bufferSize >= 1");let u=[],o=b(r=>e.subscribe(i=>{for(let s of i)s[0]===h&&(u.push(s[1]),u.length>n&&u.shift());r.down(i)}),{...m(t),initial:e.cache});return K(o,r=>{for(let i of u)r([[h,i]])})}function ce(e,n){return F(e,1,n)}function le(e){return new Promise((n,t)=>{let u=!1,o=!1,r;r=e.subscribe(i=>{for(let s of i){if(u)return;if(s[0]===h){u=!0,n(s[1]),r?(r(),r=void 0):o=!0;return}if(s[0]===p){u=!0,t(s[1]),r?(r(),r=void 0):o=!0;return}if(s[0]===T){u=!0,t(new Error("completed without DATA")),r?(r(),r=void 0):o=!0;return}}}),o&&(r?.(),r=void 0)})}function R(e,n,t){return new Promise((u,o)=>{let r=!1,i=!1,s,a=t?.skipCurrent===!0;s=e.subscribe(d=>{for(let f of d){if(r)return;if(!(a&&f[0]===h)){if(f[0]===h){let c=f[1];if(n(c)){r=!0,u(c),s?(s(),s=void 0):i=!0;return}}if(f[0]===p){r=!0,o(f[1]),s?(s(),s=void 0):i=!0;return}if(f[0]===T){r=!0,o(new Error("completed without matching value")),s?(s(),s=void 0):i=!0;return}}}}),a=!1,i&&(s?.(),s=void 0)})}var E,M;async function pe(e,n){let t=n?.predicate??(r=>r!=null),u=n?.skipCurrent;if(n?.timeoutMs==null||n.timeoutMs<=0)return await R(e,t,{skipCurrent:u});if(E===void 0){let[r,i]=await Promise.all([import("./resilience-YIWPK4YC.js"),import("./backoff-HPZMEZNF.js")]);E=r.timeout,M=i.NS_PER_MS}let o=E(e,n.timeoutMs*M);return await R(o,t,{skipCurrent:u})}function be(e,n){let t=new AbortController,u=n?.reason??new Error("cancelled via nodeSignal"),o,r=!1,i=()=>{o?(o(),o=void 0):r=!0};return o=e.subscribe(s=>{if(!t.signal.aborted)for(let a of s){if(a[0]===h&&a[1]===!0){t.abort(u),i();return}if(a[0]===p){t.abort(a[1]),i();return}if(a[0]===T){i();return}}}),r&&(o?.(),o=void 0),{signal:t.signal,dispose:()=>{o&&(o(),o=void 0)}}}var me=F;function Te(e){return e.subscribe(()=>{})}function ve(e){let n=I(0);return{node:n,increment(){let t=n.cache??0;return t>=e?!1:(n.down([[A],[h,t+1]]),!0)},get(){return n.cache??0},atCap(){return(n.cache??0)>=e}}}export{L as a,P as b,$ as c,X as d,Z as e,ee as f,ne as g,te as h,re as i,D as j,q as k,H as l,V as m,B as n,oe as o,ie as p,se as q,ue as r,ae as s,de as t,fe as u,F as v,ce as w,le as x,R as y,pe as z,be as A,me as B,Te as C,ve as D};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as N}from"./chunk-L6NSJVJZ.js";import{f as ue,j as ae}from"./chunk-626TESAC.js";import{a as V}from"./chunk-ESMPEKEV.js";import{x as L}from"./chunk-VOPGGIL7.js";import{a as S,b as P,i as se}from"./chunk-4VVTGLXJ.js";import{b as oe,c as R}from"./chunk-35JTVPOX.js";import{m as de}from"./chunk-V5A7M7RJ.js";import{D as F,F as C,m as K,o as Y}from"./chunk-LYCLF26R.js";import{b as y,c as k,d as w,f as U,g as q,h as _,i as T,j as g}from"./chunk-CK2E7BTU.js";var $=class{buf=[];head=0;get size(){return this.buf.length-this.head}push(t){this.buf.push(t)}shift(){if(this.head>=this.buf.length)return;let t=this.buf[this.head];return this.buf[this.head]=void 0,this.head++,this.head>32&&this.head*2>this.buf.length&&(this.buf=this.buf.slice(this.head),this.head=0),t}clear(){this.buf=[],this.head=0}};function W(e,t,n){if(t.length===0)throw new RangeError("budgetGate requires at least one constraint");let r=t.map(c=>c.node),i=[e,...r],l=new $,u=!1,s=!1,o=Symbol("budget-gate"),d=new Array(t.length);function f(){return t.every((c,b)=>c.check(d[b]))}function a(c){for(;l.size>0&&f();){let b=l.shift();c.emit(b)}l.size===0&&s&&(s=!1,c.down([[w]]))}return F([],(c,b)=>{for(let m=0;m<t.length;m++)d[m]=t[m].node.cache;let h=[];for(let m=0;m<i.length;m++){let O=i[m];h.push(O.subscribe(E=>{for(let M of E)p(M,m,b)}))}return()=>{for(let m of h)m()}},{...n,describeKind:"derived",meta:N("resilience","budget_gate",n?.meta)});function p(c,b,h){let m=c[0];if(b===0){if(m===y)return f()&&l.size===0?h.emit(c[1]):(l.push(c[1]),u||(u=!0,h.up([[U,o]]))),!0;if(m===k)return h.down([[k]]),!0;if(m===w)return l.size===0?h.down([[w]]):s=!0,!0;if(m===T||m===g){for(;l.size>0;)h.emit(l.shift());return s=!1,u&&(u=!1,h.up([[q,o]])),h.down([c]),!0}return!1}if(m===y&&(d[b-1]=c[1]),m===y||m===w){let O=f();return O&&l.size>0?(a(h),l.size===0&&u&&(u=!1,h.up([[q,o]]))):!O&&!u&&l.size>0&&(u=!0,h.up([[U,o]])),!0}return m===k?!0:m===g?(h.down([c]),!0):m===T}}function z(e){return typeof e=="object"&&e!==null&&"subscribe"in e&&"down"in e}function fe(e){if(e<=0)throw new RangeError("timeoutMs must be > 0");if(e>9e6)throw new RangeError("timeoutMs must be <= 9_000_000 (\u22482.5h) to stay within safe ns arithmetic")}var D=class extends ae{output;status;lastError;breakerState;droppedCount;rateLimitState;constructor(t,n={}){super(n.name??"resilient_pipeline",n.graph);let r=t,i,l,u;if(n.rateLimit!=null)if(z(n.rateLimit)){let o=r,d=n.rateLimit;r=L(d,f=>{let a={...f,maxBuffer:f.maxBuffer??1/0,meta:N("resilient","rate-limit")};return Z(o,a).node}),this.add(r,{name:"rateLimited"})}else{let o={...n.rateLimit,maxBuffer:n.rateLimit.maxBuffer??1/0,meta:N("resilient","rate-limit")},d=Z(r,o);r=d.node,i=d.droppedCount,l=d.rateLimitState,this.add(r,{name:"rateLimited"}),this.add(i,{name:"droppedCount"}),this.add(l,{name:"rateLimitState"})}if(n.budget!=null)if(z(n.budget)){let o=r,d=n.budget;r=L(d,f=>f.length>0?W(o,f,{meta:N("resilient","budget")}):o),this.add(r,{name:"budgetGated"})}else n.budget.length>0&&(r=W(r,n.budget,{meta:N("resilient","budget")}),this.add(r,{name:"budgetGated"}));if(n.breaker!=null)if(z(n.breaker)){let o=r,d=n.breaker,f=n.breakerOnOpen??"skip";r=L(d,a=>{let p=J(a);return X(p,{onOpen:f,meta:N("resilient","breaker")})(o).node}),this.add(r,{name:"breakerWrapped"})}else{let o=J(n.breaker),d=n.breakerOnOpen??"skip",f=X(o,{onOpen:d,meta:N("resilient","breaker")})(r);r=f.node,u=f.breakerState,this.add(r,{name:"breakerWrapped"}),this.add(u,{name:"breakerState"})}if(n.timeoutMs!=null)if(z(n.timeoutMs)){let o=r,d=n.timeoutMs;r=L(d,f=>(fe(f),H(o,f*1e6,{meta:N("resilient","timeout")}))),this.add(r,{name:"timeoutWrapped"})}else fe(n.timeoutMs),r=H(r,n.timeoutMs*1e6,{meta:N("resilient","timeout")}),this.add(r,{name:"timeoutWrapped"});if(n.retry!=null)if(z(n.retry)){let o=r,d=n.retry;r=L(d,f=>Q(o,{...f,meta:N("resilient","retry")})),this.add(r,{name:"retryWrapped"})}else r=Q(r,{...n.retry,meta:N("resilient","retry")}),this.add(r,{name:"retryWrapped"});n.fallback!==void 0&&(r=ce(r,n.fallback,{meta:N("resilient","fallback")}),this.add(r,{name:"fallbackWrapped"}));let s=le(r,{initialStatus:n.initialStatus??"pending",meta:N("resilient","status")});this.output=s.node,this.status=s.status,this.lastError=s.error,this.breakerState=u,this.droppedCount=i,this.rateLimitState=l,this.add(this.output,{name:"output"}),this.add(this.status,{name:"status"}),this.add(this.lastError,{name:"lastError"})}};function ye(e,t={}){let n=new D(e,t);return n.tagFactory("resilientPipeline",oe(t)),n}function v(e){return{describeKind:"derived",...e}}function we(e){return e<0?0:e}function re(e){return e[1]}function Te(e){if(typeof e!="number"||!Number.isFinite(e))throw new TypeError("backoff strategy must return a finite number");return e<0?0:e}function me(e){let t=e?.count,n=e?.backoff;if(n!==void 0&&t===void 0)throw new RangeError("retry({ backoff }) requires explicit count to prevent unbounded retries; pass { count: <n>, backoff: ... }");let r=t!==void 0?t:0;if(r<0)throw new RangeError("retry count must be >= 0");let i=n===void 0?null:typeof n=="string"?se(n):n;return{maxRetries:r,strategy:i}}function pe(e){let t={};return e?.count!==void 0&&(t.count=e.count),typeof e?.backoff=="string"&&(t.backoff=e.backoff),Object.keys(t).length>0?t:void 0}function be(e,t,n){let r=0,i=!1,l=null,u,s=new V;function o(){u?.(),u=void 0}function d(a){if(i)return;if(r>=e.maxRetries){o(),n.down([[g,a]]);return}let p=e.strategy===null?0:e.strategy(r,a,l);if(p==null){o(),n.down([[g,a]]);return}let c;try{c=Te(p)}catch{o(),n.down([[g,a]]);return}l=c,r+=1,o();let b=c>0?c/1e6:1;s.start(b,()=>{i||f()})}function f(){s.cancel(),o();let a;try{a=t()}catch(p){d(p);return}u=a.subscribe(p=>{if(!i)for(let c of p){let b=c[0];if(b===k)n.down([[k]]);else if(b===y)r=0,l=null,n.emit(c[1]);else if(b===w)n.down([[w]]);else if(b===T)o(),n.down([[T]]);else if(b===g){d(re(c));return}else n.down([c])}})}return f(),()=>{i=!0,s.cancel(),o()}}function Q(e,t){return typeof e=="function"?ge(e,t):ke(e,t)}function ke(e,t){let n=me(t);return C(r=>be(n,()=>e,r),{...v(),initial:e.cache,meta:{...t?.meta??{},...R("retry",pe(t))}})}function ge(e,t){let n=me(t);return C(r=>be(n,e,r),{...v(),initial:t?.initial,meta:{...t?.meta??{},...R("retry",pe(t))}})}var ee=class extends Error{name="CircuitOpenError";constructor(){super("Circuit breaker is open")}};function J(e){let t=Math.max(1,e?.failureThreshold??5),n=we(e?.cooldownNs??30*1e9),r=e?.cooldown??null,i=Math.max(1,e?.halfOpenMax??1),l=e?.now??Y,u="closed",s=0,o=0,d=0,f=n,a=0;function p(){if(!r)return n;let h=r(o);return h!==null?h:n}function c(){u="open",f=p(),d=l(),a=0}return{canExecute(){return u==="closed"?!0:u==="open"?l()-d>=f?(u="half-open",a=1,!0):!1:a<i?(a++,!0):!1},recordSuccess(){u==="half-open"?(u="closed",s=0,o=0):u==="closed"&&(s=0)},recordFailure(h){if(u==="half-open"){o++,c();return}u==="closed"&&(s++,s>=t&&c())},get state(){return u},get failureCount(){return s},reset(){u="closed",s=0,o=0,a=0}}}function X(e,t){let n=t?.onOpen??"skip",r=t?.meta;return i=>{let l=F([],(u,s)=>{function o(){l.meta.breakerState.down([[y,e.state]])}let d=i.subscribe(f=>{for(let a of f){let p=a[0];p===k?s.down([[k]]):p===y?e.canExecute()?(o(),s.emit(a[1])):(o(),n==="error"?s.down([[g,new ee]]):s.down([[w]])):p===w?s.down([[w]]):p===T?(e.recordSuccess(),o(),s.down([[T]])):p===g?(e.recordFailure(re(a)),o(),s.down([a])):s.down([a])}});return o(),d},{...v(),meta:{...r??{},breakerState:e.state,...R("withBreaker",{onOpen:n})},completeWhenDepsComplete:!1,initial:i.cache});return{node:l,breakerState:l.meta.breakerState}}}function Ne(e,t,n){if(e<=0)throw new RangeError("capacity must be > 0");if(t<0)throw new RangeError("refillPerSecond must be >= 0");let r=n?.clock??Y,i=e,l=r();function u(s){if(t>0){let o=s-l;i=Math.min(e,i+o/1e9*t)}l=s}return{available(){return u(r()),i},tryConsume(s=1){if(s<=0)return!0;let o=r();return u(o),i>=s?(i-=s,!0):!1},putBack(s=1){s<=0||(u(r()),i=Math.min(e,i+s))}}}var te=class extends Error{name="RateLimiterOverflowError";constructor(t){super(`rateLimiter buffer overflow (maxBuffer=${t})`)}};function Re(e,t){return e.droppedCount===t.droppedCount&&e.pendingCount===t.pendingCount&&e.paused===t.paused}var G=Object.freeze({droppedCount:0,pendingCount:0,paused:!1});function Z(e,t){let{maxEvents:n,windowNs:r}=t;if(n<=0)throw new RangeError("maxEvents must be > 0");if(r<=0)throw new RangeError("windowNs must be > 0");let i=t.maxBuffer;if(i===void 0)throw new RangeError("rateLimiter requires explicit maxBuffer (use Infinity to opt in to unbounded)");let l=i===1/0;if(!l&&(!Number.isInteger(i)||i<1))throw new RangeError("maxBuffer must be a positive integer (or Infinity for unbounded)");let u=t.onOverflow??"drop-newest",s=n*1e9/r,o=C(d=>{let f=Ne(n,s),a=l?Se():Oe(i),p=new V,c=!1,b=0,h=1e9/s,m=o.meta.droppedCount,O=o.meta.rateLimitState,E=G;function M(){m.emit(b);let A={droppedCount:b,pendingCount:a.size,paused:a.size>0};Re(E,A)||(E=A,O.emit(A))}E=G,m.emit(0),O.emit(G);function ie(){for(;a.size>0;)if(f.tryConsume(1))d.emit(a.shift()),M();else{p.start(Math.max(1,h/1e6),ie);return}}function j(){b+=1,M()}function I(){for(c=!0,p.cancel();a.size>0;)a.shift();b=0}let he=e.subscribe(A=>{for(let x of A){if(c)return;let B=x[0];if(B===k)d.down([[k]]);else if(B===y){if(!l&&a.size>=i)if(u==="drop-newest")j();else if(u==="drop-oldest")a.shift(),a.push(x[1]),j();else{j(),I(),d.down([[g,new te(i)]]);return}else a.push(x[1]),M();ie()}else if(B===w)d.down([[w]]);else if(B===T)I(),d.down([[T]]);else if(B===g)I(),d.down([x]);else if(B===_){I(),d.down([x]);return}else d.down([x])}});return()=>{c=!0,p.cancel(),he()}},{...v(),initial:e.cache,meta:{...t.meta??{},droppedCount:0,rateLimitState:G,...R("rateLimiter",t)}});return{node:o,droppedCount:o.meta.droppedCount,rateLimitState:o.meta.rateLimitState}}function Oe(e){let t=new ue(e);return{push:n=>t.push(n),shift:()=>t.shift(),get size(){return t.size}}}function Se(){let e=[];return{push:t=>{e.push(t)},shift:()=>e.shift(),get size(){return e.length}}}function le(e,t){let n=t?.initialStatus??"pending",r=t?.meta,i=F([],(l,u)=>{let s=n;return i.meta.status.down([[y,n]]),i.meta.error.down([[y,null]]),e.subscribe(d=>{for(let f of d){let a=f[0];if(a===k)u.down([[k]]);else if(a===y)s==="errored"?K(()=>{i.meta.error.down([[y,null]]),i.meta.status.down([[y,"running"]])}):i.meta.status.down([[y,"running"]]),s="running",u.emit(f[1]);else if(a===w)u.down([[w]]);else if(a===T)i.meta.status.down([[y,"completed"]]),s="completed",u.down([[T]]);else if(a===g){let p=re(f);K(()=>{i.meta.error.down([[y,p]]),i.meta.status.down([[y,"errored"]])}),s="errored",u.down([f])}else u.down([f])}})},{...v(),meta:{...r??{},status:n,error:null,...R("withStatus",{initialStatus:n})},completeWhenDepsComplete:!1,resubscribable:!0,initial:e.cache});return{node:i,status:i.meta.status,error:i.meta.error}}var ne=class extends Error{name="TimeoutError";constructor(t){super(`Timed out after ${t/1e6}ms`)}};function ve(e){return e!=null&&typeof e=="object"&&"cache"in e&&typeof e.subscribe=="function"}function xe(e){return e!=null&&typeof e.then=="function"}function Be(e){return e!=null&&typeof e=="object"&&typeof e[Symbol.asyncIterator]=="function"}function ce(e,t,n){let r=n?.meta;return C(i=>{let l,u;function s(){u?.(),u=void 0,ve(t)||xe(t)||Be(t)?l=de(t).subscribe(d=>{i.down(d);for(let f of d){let a=f[0];if(a===T||a===g||a===_){l=void 0;return}}}):(i.emit(t),i.down([[T]]))}return u=e.subscribe(o=>{for(let d of o){let f=d[0];if(f===k)i.down([[k]]);else if(f===y)i.emit(d[1]);else if(f===w)i.down([[w]]);else if(f===T)i.down([[T]]);else if(f===g){s();return}else if(f===_){l?.(),i.down([d]);return}else i.down([d])}}),()=>{u?.(),l?.()}},{...v(),initial:e.cache,meta:{...r??{},...R("fallback")}})}function H(e,t,n){if(t<=0)throw new RangeError("timeoutNs must be > 0");let r=n?.meta;return C(i=>{let l=!1,u=new V;function s(){let d=t/1e6;u.start(d,()=>{l||(l=!0,o(),i.down([[g,new ne(t)]]))})}let o=e.subscribe(d=>{for(let f of d){if(l)return;let a=f[0];if(a===k)i.down([[k]]);else if(a===y)s(),i.emit(f[1]);else if(a===w)i.down([[w]]);else if(a===T){u.cancel(),l=!0,i.down([[T]]);return}else if(a===g){u.cancel(),l=!0,i.down([f]);return}else if(a===_){u.cancel(),l=!0,i.down([f]);return}else i.down([f])}});return s(),()=>{l=!0,u.cancel(),o()}},{...v(),initial:e.cache,meta:{...r??{},...R("timeout",{timeoutNs:t})}})}export{W as a,D as b,ye as c,Q as d,ee as e,J as f,X as g,Ne as h,te as i,Z as j,le as k,ne as l,ce as m,H as n};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as B}from"./chunk-4VVTGLXJ.js";import{m as k}from"./chunk-L77I47VU.js";import{c as h}from"./chunk-35JTVPOX.js";import{D as N,F as w,G as P,o as U}from"./chunk-LYCLF26R.js";import{a as A,b as p,c as W,d as m,i as a,j as b}from"./chunk-CK2E7BTU.js";function c(d){return{describeKind:"derived",...d}}function S(d){return{describeKind:"derived",partial:!0,...d}}function Z(d,i,s){return N([d],(t,e)=>{let n=t[0];if(n==null||n.length===0){e.down([[m]]);return}for(let o of n)e.emit(i(o))},{...c(s),meta:{...h("map"),...s?.meta??{}}})}function V(d,i,s){return N([d],(t,e)=>{let n=t[0];if(n==null||n.length===0){e.down([[m]]);return}let o=!1;for(let r of n)i(r)&&(e.emit(r),o=!0);o||e.down([[m]])},{...c(s),meta:{...h("filter"),...s?.meta??{}}})}function $(d,i,s,t){return N([d],(e,n,o)=>{"acc"in o.store||(o.store.acc=s);let r=e[0];if(r==null||r.length===0){n.down([[m]]);return}for(let u of r)o.store.acc=i(o.store.acc,u),n.emit(o.store.acc)},{...c(t),initial:s,resetOnTeardown:!0,meta:{...h("scan",{initial:s}),...t?.meta??{}}})}function ee(d,i,s,t){return N([d],(e,n,o)=>{if("acc"in o.store||(o.store.acc=s),o.terminalDeps[0]===!0){n.emit(o.store.acc),n.down([[a]]);return}let r=e[0];if(r==null||r.length===0){n.down([[m]]);return}for(let u of r)o.store.acc=i(o.store.acc,u)},{...c(t),completeWhenDepsComplete:!1,meta:{...h("reduce",{initial:s}),...t?.meta??{}}})}function C(d,i,s){return i<=0?N([d],(t,e,n)=>{n.store.completed||(n.store.completed=!0,e.down([[a]]))},{...c(s),completeWhenDepsComplete:!1,meta:{...h("take",{count:i}),...s?.meta??{}}}):N([d],(t,e,n)=>{if("taken"in n.store||(n.store.taken=0),n.store.done){e.down([[m]]);return}if(n.terminalDeps[0]===!0){n.store.done=!0,e.down([[a]]);return}let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}for(let r of o)if(n.store.taken++,e.emit(r),n.store.taken>=i){n.store.done=!0,e.down([[a]]);return}},{...c(s),completeWhenDepsComplete:!1,meta:{...h("take",{count:i}),...s?.meta??{}}})}function K(d,i,s){return N([d],(t,e,n)=>{"skipped"in n.store||(n.store.skipped=0);let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}let r=!1;for(let u of o)n.store.skipped++,n.store.skipped<=i||(e.emit(u),r=!0);r||e.down([[m]])},c(s))}function ne(d,i,s){return N([d],(t,e,n)=>{if(n.store.done){e.down([[m]]);return}let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}for(let r of o){if(!i(r)){n.store.done=!0,e.down([[a]]);return}e.emit(r)}},{...c(s),completeWhenDepsComplete:!1})}function te(d,i,s){let t=s?.predicate??(o=>o[0]===p),{predicate:e,...n}=s??{};return w(o=>{let r=!1,u=d.subscribe(l=>{if(!r)for(let T of l){if(r)return;T[0]===p?o.emit(T[1]):(T[0]===a||T[0]===b)&&(r=!0,o.down([T]))}}),f=i.subscribe(l=>{if(!r)for(let T of l){if(r)return;if(t(T)){r=!0,o.down([[a]]);return}}});return()=>{u(),f()}},c(n))}function oe(d,i){return C(d,1,i)}function re(d,i){let{defaultValue:s,...t}=i??{},e=i!=null&&Object.hasOwn(i,"defaultValue");return N([d],(n,o,r)=>{if(r.terminalDeps[0]===!0){r.store.has?o.emit(r.store.latest):e&&o.emit(s),o.down([[a]]);return}let u=n[0];if(u==null||u.length===0){o.down([[m]]);return}r.store.latest=u.at(-1),r.store.has=!0},{...c(t),completeWhenDepsComplete:!1})}function se(d,i,s){return C(V(d,i,s),1,s)}function ie(d,i,s){return C(K(d,i,s),1,s)}function ue(d,i,s){if(typeof i=="function")return N([d],(e,n)=>{let o=e[0];if(o==null||o.length===0){n.down([[m]]);return}for(let r of o)i(r),n.emit(r)},{...c(s),meta:{...h("tap"),...s?.meta??{}}});let t=i;return N([d],(e,n,o)=>{if(o.terminalDeps[0]!==void 0){o.terminalDeps[0]===!0?(t.complete?.(),n.down([[a]])):(t.error?.(o.terminalDeps[0]),n.down([[b,o.terminalDeps[0]]]));return}let r=e[0];if(r==null||r.length===0){n.down([[m]]);return}for(let u of r)t.data?.(u),n.emit(u)},{...c(s),completeWhenDepsComplete:!1,meta:{...h("tap"),...s?.meta??{}}})}function q(d,i,s){let t=s?.where??(n=>n!=null),e=!1;return N([d],(n,o)=>{let r=n[0];if(r==null||r.length===0){o.down([[m]]);return}for(let u of r)!e&&t(u)&&(e=!0,i(u)),o.emit(u)},c(s))}var fe=q;function de(d,i=Object.is,s){return N([d],(t,e,n)=>{let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}let r=!1;for(let u of o)n.store.hasPrev&&i(n.store.prev,u)||(n.store.prev=u,n.store.hasPrev=!0,e.emit(u),r=!0);r||e.down([[m]])},{...c(s),meta:{...h("distinctUntilChanged"),...s?.meta??{}}})}function le(d,i){return N([d],(s,t,e)=>{let n=s[0];if(n==null||n.length===0){t.down([[m]]);return}let o=!1;for(let r of n)if(!e.store.hasPrev)e.store.prev=r,e.store.hasPrev=!0;else{let u=[e.store.prev,r];e.store.prev=r,t.emit(u),o=!0}o||t.down([[m]])},c(i))}function F(...d){let i=[...d];return P(i,s=>s,{...c(),equals:(s,t)=>{if(s.length!==t.length)return!1;for(let e=0;e<s.length;e++)if(!Object.is(s[e],t[e]))return!1;return!0}})}function ae(d,i,s){return N([d,i],(t,e,n)=>{let o=t[0],r=t[1],u=r!=null&&r.length>0?r.at(-1):n.prevData[1];if(o!=null&&o.length>0){if(!(r!=null&&r.length>0)&&n.prevData[1]===void 0){e.down([[m]]);return}for(let f of o)e.emit([f,u])}else e.down([[m]])},{...S(s),meta:{...h("withLatestFrom"),...s?.meta??{}}})}function ce(...d){return d.length===0?w(i=>{i.down([[a]])},{...c(),meta:{...h("merge")}}):w(i=>{let s=d.length,t=0,e=[];for(let n of d){let o=n.subscribe(r=>{for(let u of r)u[0]===p?i.emit(u[1]):u[0]===a?(t+=1,t>=s&&i.down([[a]])):u[0]===b&&i.down([u])});e.push(o)}return()=>{for(let n of e)n()}},{...c(),meta:{...h("merge")}})}function Te(...d){let i=d.length;return i===0?w(s=>{s.emit([]),s.down([[a]])},c()):w(s=>{let t=Array.from({length:i},()=>[]),e=i;function n(){for(;t.every(r=>r.length>0);){let r=t.map(u=>u.shift());s.emit(r)}}let o=[];for(let r=0;r<i;r++){let u=r,f=d[r].subscribe(l=>{for(let T of l)T[0]===p?(t[u].push(T[1]),n()):T[0]===a?(e-=1,(e===0||t[u].length===0)&&s.down([[a]])):T[0]===b&&s.down([T])});o.push(f)}return()=>{for(let r of o)r()}},c())}function pe(d,i,s){return w(t=>{let e=0,n=[],o,r;return r=i.subscribe(u=>{for(let f of u)e===0?f[0]===p?n.push(f[1]):f[0]===b&&t.down([f]):f[0]===p?t.emit(f[1]):(f[0]===a||f[0]===b)&&t.down([f])}),o=d.subscribe(u=>{for(let f of u)if(e===0)if(f[0]===p)t.emit(f[1]);else if(f[0]===a){e=1;for(let l of n)t.emit(l);n.length=0}else f[0]===b&&t.down([f])}),()=>{o?.(),r?.()}},c(s))}function me(...d){return d.length===0?w(i=>{i.down([[a]])},c()):d.length===1?N([d[0]],(i,s)=>{let t=i[0];if(t==null||t.length===0){s.down([[m]]);return}for(let e of t)s.emit(e)},c()):w(i=>{let s=null,t=[];for(let e=0;e<d.length;e++){let n=e,o=d[e].subscribe(r=>{for(let u of r){if(s!==null&&n!==s)return;u[0]===p?(s===null&&(s=n),i.emit(u[1])):(u[0]===a||u[0]===b)&&(s===null||n===s)&&i.down([u])}});t.push(o)}return()=>{for(let e of t)e()}},c())}function I(d,i,s){let t,e=!1,n=()=>{e||(e=!0,s())};return t=d.subscribe(o=>{let r=!1,u=!1;for(let f of o)f[0]!==A&&(f[0]===p?i.emit(f[1]):f[0]===a?r=!0:f[0]===b?(u=!0,i.down([f])):(f[0]===W||f[0]===m)&&i.down([f]));u?(t?.(),t=void 0,n()):r&&n()}),()=>{t?.(),t=void 0}}function be(d,i,s){let t,e=!1;function n(){t?.(),t=void 0}return N([d],(o,r,u)=>{if(u.terminalDeps[0]!=null&&u.terminalDeps[0]!==!0){n();return}if(u.terminalDeps[0]===!0){e=!0,t||r.down([[a]]);return}let f=o[0];if(!(f==null||f.length===0))return n(),t=I(k(i(f[f.length-1])),r,()=>{n(),e&&r.down([[a]])}),{deactivate:()=>{n(),e=!1}}},{...c(s),completeWhenDepsComplete:!1,meta:{...h("switchMap"),...s?.meta??{}}})}function we(d,i,s){let t,e=!1;function n(){t?.(),t=void 0}return N([d],(o,r,u)=>{if(u.terminalDeps[0]!=null&&u.terminalDeps[0]!==!0){n();return}if(u.terminalDeps[0]===!0){e=!0,t||r.down([[a]]);return}let f=o[0];if(!(f==null||f.length===0))return t===void 0?t=I(k(i(f[0])),r,()=>{n(),e&&r.down([[a]])}):r.down([[m]]),{deactivate:()=>{n(),e=!1}}},{...c(s),completeWhenDepsComplete:!1})}function Ne(d,i,s){let{maxBuffer:t,...e}=s??{},n=[],o,r=!1,u;function f(){o?.(),o=void 0}function l(){if(!u||o!==void 0)return;if(n.length===0){r&&u.down([[a]]);return}let v=n.shift();o=I(k(i(v)),u,()=>{f(),l()})}function T(v){t&&t>0&&n.length>=t&&n.shift(),n.push(v),l()}return N([d],(v,x,E)=>{if(u=x,E.terminalDeps[0]!=null&&E.terminalDeps[0]!==!0){f(),n.length=0;return}if(E.terminalDeps[0]===!0){r=!0,l();return}let R=v[0];if(!(R==null||R.length===0)){for(let g of R)T(g);return{deactivate:()=>{f(),n.length=0,r=!1}}}},{...c(e),completeWhenDepsComplete:!1})}function L(d,i,s){let{concurrent:t,...e}=s??{},n=t!=null&&t>0?t:Number.POSITIVE_INFINITY,o=0,r=!1,u=new Set,f=[],l;function T(){r&&o===0&&f.length===0&&l&&l.down([[a]])}function v(g){if(!l)return;o++;let O;O=I(k(i(g)),l,()=>{O&&u.delete(O),o--,x(),T()}),u.add(O)}function x(){for(;f.length>0&&o<n;)v(f.shift())}function E(g){o<n?v(g):f.push(g)}function R(){for(let g of u)g();u.clear(),o=0,f.length=0}return N([d],(g,O,y)=>{if(l=O,y.terminalDeps[0]!=null&&y.terminalDeps[0]!==!0){R();return}if(y.terminalDeps[0]===!0){r=!0,T();return}let D=g[0];if(!(D==null||D.length===0)){for(let M of D)E(M);return{deactivate:()=>{R(),r=!1}}}},{...c(e),completeWhenDepsComplete:!1})}var he=L;function ve(d,i,s){return w(t=>{let e=new Set;function n(){for(let r of e)clearTimeout(r);e.clear()}let o=d.subscribe(r=>{for(let u of r)if(u[0]===p){let f=setTimeout(()=>{e.delete(f),t.emit(u[1])},i);e.add(f)}else if(u[0]===a){let f=setTimeout(()=>{e.delete(f),t.down([[a]])},i);e.add(f)}else u[0]===b&&(n(),t.down([u]))});return()=>{o(),n()}},c(s))}function _(d,i,s){return w(t=>{let e,n;function o(){e!==void 0&&(clearTimeout(e),e=void 0)}let r=d.subscribe(u=>{for(let f of u)f[0]===p?(o(),n=f[1],e=setTimeout(()=>{e=void 0,t.emit(n)},i)):f[0]===a?(e!==void 0&&(o(),t.emit(n)),t.down([[a]])):f[0]===b&&(o(),t.down([f]))});return()=>{r(),o()}},{...c(s),meta:{...h("debounce",{ms:i}),...s?.meta??{}}})}function j(d,i,s){let{leading:t,trailing:e,...n}=s??{},o=t!==!1,r=e===!0,u=i*1e6;return w(f=>{let l,T=-1/0,v,x=!1;function E(){l!==void 0&&(clearTimeout(l),l=void 0)}let R=d.subscribe(g=>{for(let O of g)if(O[0]===p){let y=O[1],D=U();if(o&&D-T>=u)T=D,f.emit(y),E(),r&&(l=setTimeout(()=>{l=void 0,x&&(T=U(),f.emit(v),x=!1)},i));else if(r&&(v=y,x=!0,l===void 0)){let M=(D-T)/1e6;l=setTimeout(()=>{l=void 0,x&&(T=U(),f.emit(v),x=!1)},Math.max(0,i-M))}}else(O[0]===a||O[0]===b)&&(E(),f.down([O]))});return()=>{R(),E()}},{...c(n),meta:{...h("throttle",{ms:i,leading:o,trailing:r}),...n.meta??{}}})}function ge(d,i,s){return w(t=>{let e,n=!1,o=!1,r=d.subscribe(f=>{if(!n)for(let l of f){if(n)return;l[0]===p?e={v:l[1]}:l[0]===b?(n=!0,t.down([l])):l[0]===a&&(o=!0,e=void 0)}}),u=i.subscribe(f=>{if(!n)for(let l of f){if(n)return;l[0]===p?e!==void 0&&!o&&t.emit(e.v):l[0]===b?(n=!0,t.down([l])):l[0]===a&&(n=!0,t.down([[a]]))}});return()=>{r(),u()}},c(s))}function Oe(d,i,s){return w(t=>{let e,n,o=!1;function r(){e!==void 0&&(clearTimeout(e),e=void 0)}let u=d.subscribe(f=>{for(let l of f)l[0]===p?(n=l[1],o=!0,r(),e=setTimeout(()=>{e=void 0,o&&(o=!1,t.emit(n))},i)):(l[0]===a||l[0]===b)&&(r(),t.down([l]))});return()=>{u(),r()}},c(s))}function xe(d,i,s){let{with:t,...e}=s??{},n=t??new Error("timeout");return w(o=>{let r;function u(){clearTimeout(r),r=setTimeout(()=>{r=void 0,o.down([[b,n]])},i)}u();let f=d.subscribe(l=>{for(let T of l)T[0]===p?(u(),o.emit(T[1])):(T[0]===a||T[0]===b)&&(clearTimeout(r),o.down([T]))});return()=>{f(),clearTimeout(r)}},c(e))}function Ee(d,i,s){return w(t=>{let e=[],n=d.subscribe(r=>{for(let u of r)u[0]===p?e.push(u[1]):u[0]===a?(e.length>0&&t.emit([...e]),e.length=0,t.down([[a]])):u[0]===b&&t.down([u])}),o=i.subscribe(r=>{for(let u of r)u[0]===p?e.length>0&&(t.emit([...e]),e.length=0):u[0]===a?t.down([[a]]):u[0]===b&&t.down([u])});return()=>{n(),o(),e.length=0}},c(s))}function Re(d,i,s){if(i<=0)throw new RangeError("bufferCount expects count > 0");return w(t=>{let e=[],n=d.subscribe(o=>{for(let r of o)r[0]===p?(e.push(r[1]),e.length>=i&&t.emit(e.splice(0,e.length))):r[0]===a?(e.length>0&&t.emit([...e]),e.length=0,t.down([[a]])):r[0]===b&&t.down([r])});return()=>{n(),e.length=0}},c(s))}function De(d,i,s){if(i<=0)throw new RangeError("windowCount expects count > 0");return w(t=>{let e,n=0;function o(){let u=w(f=>(e=f.down.bind(f),()=>{e=void 0}),c());n=0,t.emit(u)}let r=d.subscribe(u=>{for(let f of u)f[0]===p?(e||o(),e?.([[p,f[1]]]),n+=1,n>=i&&(e?.([[a]]),e=void 0)):f[0]===a?(e?.([[a]]),e=void 0,t.down([[a]])):f[0]===b&&(e?.([f]),e=void 0,t.down([f]))});return()=>{r(),e?.([[a]]),e=void 0}},c(s))}function ye(d,i,s){return w(t=>{let e=[],n=setInterval(()=>{e.length>0&&(t.emit([...e]),e.length=0)},i),o=d.subscribe(r=>{for(let u of r)u[0]===p?e.push(u[1]):u[0]===a?(clearInterval(n),e.length>0&&t.emit([...e]),e.length=0,t.down([[a]])):u[0]===b&&(clearInterval(n),t.down([u]))});return()=>{o(),clearInterval(n),e.length=0}},{...c(s),meta:{...h("bufferTime",{ms:i}),...s?.meta??{}}})}function ke(d,i,s){return w(t=>{let e;function n(){e?.([[a]]),e=void 0}function o(){let f=w(l=>(e=l.down.bind(l),()=>{e=void 0}),c());t.emit(f)}o();let r=setInterval(()=>{n(),o()},i),u=d.subscribe(f=>{for(let l of f)l[0]===p?e?.([[p,l[1]]]):l[0]===a?(clearInterval(r),n(),t.down([[a]])):l[0]===b&&(clearInterval(r),e?.([l]),n(),t.down([l]))});return()=>{u(),clearInterval(r),n()}},c(s))}function Ue(d,i,s){return w(t=>{let e;function n(){e?.([[a]]),e=void 0}function o(){let f=w(l=>(e=l.down.bind(l),()=>{e=void 0}),c());t.emit(f)}let r=d.subscribe(f=>{for(let l of f)l[0]===p?(e||o(),e?.([[p,l[1]]])):l[0]===a?(n(),t.down([[a]])):l[0]===b&&(e?.([l]),e=void 0,t.down([l]))}),u=i.subscribe(f=>{for(let l of f)l[0]===p&&(n(),o())});return()=>{r(),u(),n()}},c(s))}function Ie(d,i){return w((s,t)=>{"n"in t.store||(t.store.n=0);let e=setInterval(()=>{s.emit(t.store.n),t.store.n=t.store.n+1},d);return()=>clearInterval(e)},c(i))}function Me(d,i,s){if(i<=0)throw new RangeError("repeat expects count > 0");return w(t=>{let e=i,n,o=()=>{n?.(),n=d.subscribe(r=>{let u=!1,f=[];for(let l of r)l[0]===a?u=!0:f.push(l);f.length>0&&t.down(f),u&&(n?.(),n=void 0,e-=1,e>0?o():t.down([[a]]))})};return o(),()=>{n?.()}},c(s))}function Ce(d,i){return N([d],(s,t)=>{let e=s[0];if(e==null||e.length===0){t.down([[m]]);return}for(let n of e)t.emit(n)},c(i))}function Y(d,i,s){return w(t=>{let e=d.subscribe(n=>{for(let o of n)if(o[0]===p)t.emit(o[1]);else if(o[0]===b)try{t.emit(i(o[1]))}catch(r){t.down([[b,r]])}else o[0]===a&&t.down([[a]])});return()=>{e()}},c(s))}function Ae(d,i,s){return N([d,i],(t,e,n)=>{let o=t[1];if(!(o!=null&&o.length>0?o.at(-1):n.prevData[1])){e.down([[m]]);return}let u=t[0];if(u!=null&&u.length>0){for(let f of u)e.emit(f);return}if(o!=null&&o.length>0&&n.prevData[0]!==void 0){e.emit(n.prevData[0]);return}e.down([[m]])},S(s))}var We=F,Pe=_,Be=j,Se=Y;export{Z as a,V as b,$ as c,ee as d,C as e,K as f,ne as g,te as h,oe as i,re as j,se as k,ie as l,ue as m,q as n,fe as o,de as p,le as q,F as r,ae as s,ce as t,Te as u,pe as v,me as w,be as x,we as y,Ne as z,L as A,he as B,ve as C,_ as D,j as E,ge as F,Oe as G,xe as H,Ee as I,Re as J,De as K,ye as L,ke as M,Ue as N,Ie as O,Me as P,Ce as Q,Y as R,Ae as S,We as T,Pe as U,Be as V,Se as W};
|
|
1
|
+
import{a as B}from"./chunk-4VVTGLXJ.js";import{c as h}from"./chunk-35JTVPOX.js";import{m as k}from"./chunk-V5A7M7RJ.js";import{D as N,F as w,G as P,o as U}from"./chunk-LYCLF26R.js";import{a as A,b as p,c as W,d as m,i as a,j as b}from"./chunk-CK2E7BTU.js";function c(d){return{describeKind:"derived",...d}}function S(d){return{describeKind:"derived",partial:!0,...d}}function Z(d,i,s){return N([d],(t,e)=>{let n=t[0];if(n==null||n.length===0){e.down([[m]]);return}for(let o of n)e.emit(i(o))},{...c(s),meta:{...h("map"),...s?.meta??{}}})}function V(d,i,s){return N([d],(t,e)=>{let n=t[0];if(n==null||n.length===0){e.down([[m]]);return}let o=!1;for(let r of n)i(r)&&(e.emit(r),o=!0);o||e.down([[m]])},{...c(s),meta:{...h("filter"),...s?.meta??{}}})}function $(d,i,s,t){return N([d],(e,n,o)=>{"acc"in o.store||(o.store.acc=s);let r=e[0];if(r==null||r.length===0){n.down([[m]]);return}for(let u of r)o.store.acc=i(o.store.acc,u),n.emit(o.store.acc)},{...c(t),initial:s,resetOnTeardown:!0,meta:{...h("scan",{initial:s}),...t?.meta??{}}})}function ee(d,i,s,t){return N([d],(e,n,o)=>{if("acc"in o.store||(o.store.acc=s),o.terminalDeps[0]===!0){n.emit(o.store.acc),n.down([[a]]);return}let r=e[0];if(r==null||r.length===0){n.down([[m]]);return}for(let u of r)o.store.acc=i(o.store.acc,u)},{...c(t),completeWhenDepsComplete:!1,meta:{...h("reduce",{initial:s}),...t?.meta??{}}})}function C(d,i,s){return i<=0?N([d],(t,e,n)=>{n.store.completed||(n.store.completed=!0,e.down([[a]]))},{...c(s),completeWhenDepsComplete:!1,meta:{...h("take",{count:i}),...s?.meta??{}}}):N([d],(t,e,n)=>{if("taken"in n.store||(n.store.taken=0),n.store.done){e.down([[m]]);return}if(n.terminalDeps[0]===!0){n.store.done=!0,e.down([[a]]);return}let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}for(let r of o)if(n.store.taken++,e.emit(r),n.store.taken>=i){n.store.done=!0,e.down([[a]]);return}},{...c(s),completeWhenDepsComplete:!1,meta:{...h("take",{count:i}),...s?.meta??{}}})}function K(d,i,s){return N([d],(t,e,n)=>{"skipped"in n.store||(n.store.skipped=0);let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}let r=!1;for(let u of o)n.store.skipped++,n.store.skipped<=i||(e.emit(u),r=!0);r||e.down([[m]])},c(s))}function ne(d,i,s){return N([d],(t,e,n)=>{if(n.store.done){e.down([[m]]);return}let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}for(let r of o){if(!i(r)){n.store.done=!0,e.down([[a]]);return}e.emit(r)}},{...c(s),completeWhenDepsComplete:!1})}function te(d,i,s){let t=s?.predicate??(o=>o[0]===p),{predicate:e,...n}=s??{};return w(o=>{let r=!1,u=d.subscribe(l=>{if(!r)for(let T of l){if(r)return;T[0]===p?o.emit(T[1]):(T[0]===a||T[0]===b)&&(r=!0,o.down([T]))}}),f=i.subscribe(l=>{if(!r)for(let T of l){if(r)return;if(t(T)){r=!0,o.down([[a]]);return}}});return()=>{u(),f()}},c(n))}function oe(d,i){return C(d,1,i)}function re(d,i){let{defaultValue:s,...t}=i??{},e=i!=null&&Object.hasOwn(i,"defaultValue");return N([d],(n,o,r)=>{if(r.terminalDeps[0]===!0){r.store.has?o.emit(r.store.latest):e&&o.emit(s),o.down([[a]]);return}let u=n[0];if(u==null||u.length===0){o.down([[m]]);return}r.store.latest=u.at(-1),r.store.has=!0},{...c(t),completeWhenDepsComplete:!1})}function se(d,i,s){return C(V(d,i,s),1,s)}function ie(d,i,s){return C(K(d,i,s),1,s)}function ue(d,i,s){if(typeof i=="function")return N([d],(e,n)=>{let o=e[0];if(o==null||o.length===0){n.down([[m]]);return}for(let r of o)i(r),n.emit(r)},{...c(s),meta:{...h("tap"),...s?.meta??{}}});let t=i;return N([d],(e,n,o)=>{if(o.terminalDeps[0]!==void 0){o.terminalDeps[0]===!0?(t.complete?.(),n.down([[a]])):(t.error?.(o.terminalDeps[0]),n.down([[b,o.terminalDeps[0]]]));return}let r=e[0];if(r==null||r.length===0){n.down([[m]]);return}for(let u of r)t.data?.(u),n.emit(u)},{...c(s),completeWhenDepsComplete:!1,meta:{...h("tap"),...s?.meta??{}}})}function q(d,i,s){let t=s?.where??(n=>n!=null),e=!1;return N([d],(n,o)=>{let r=n[0];if(r==null||r.length===0){o.down([[m]]);return}for(let u of r)!e&&t(u)&&(e=!0,i(u)),o.emit(u)},c(s))}var fe=q;function de(d,i=Object.is,s){return N([d],(t,e,n)=>{let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}let r=!1;for(let u of o)n.store.hasPrev&&i(n.store.prev,u)||(n.store.prev=u,n.store.hasPrev=!0,e.emit(u),r=!0);r||e.down([[m]])},{...c(s),meta:{...h("distinctUntilChanged"),...s?.meta??{}}})}function le(d,i){return N([d],(s,t,e)=>{let n=s[0];if(n==null||n.length===0){t.down([[m]]);return}let o=!1;for(let r of n)if(!e.store.hasPrev)e.store.prev=r,e.store.hasPrev=!0;else{let u=[e.store.prev,r];e.store.prev=r,t.emit(u),o=!0}o||t.down([[m]])},c(i))}function F(...d){let i=[...d];return P(i,s=>s,{...c(),equals:(s,t)=>{if(s.length!==t.length)return!1;for(let e=0;e<s.length;e++)if(!Object.is(s[e],t[e]))return!1;return!0}})}function ae(d,i,s){return N([d,i],(t,e,n)=>{let o=t[0],r=t[1],u=r!=null&&r.length>0?r.at(-1):n.prevData[1];if(o!=null&&o.length>0){if(!(r!=null&&r.length>0)&&n.prevData[1]===void 0){e.down([[m]]);return}for(let f of o)e.emit([f,u])}else e.down([[m]])},{...S(s),meta:{...h("withLatestFrom"),...s?.meta??{}}})}function ce(...d){return d.length===0?w(i=>{i.down([[a]])},{...c(),meta:{...h("merge")}}):w(i=>{let s=d.length,t=0,e=[];for(let n of d){let o=n.subscribe(r=>{for(let u of r)u[0]===p?i.emit(u[1]):u[0]===a?(t+=1,t>=s&&i.down([[a]])):u[0]===b&&i.down([u])});e.push(o)}return()=>{for(let n of e)n()}},{...c(),meta:{...h("merge")}})}function Te(...d){let i=d.length;return i===0?w(s=>{s.emit([]),s.down([[a]])},c()):w(s=>{let t=Array.from({length:i},()=>[]),e=i;function n(){for(;t.every(r=>r.length>0);){let r=t.map(u=>u.shift());s.emit(r)}}let o=[];for(let r=0;r<i;r++){let u=r,f=d[r].subscribe(l=>{for(let T of l)T[0]===p?(t[u].push(T[1]),n()):T[0]===a?(e-=1,(e===0||t[u].length===0)&&s.down([[a]])):T[0]===b&&s.down([T])});o.push(f)}return()=>{for(let r of o)r()}},c())}function pe(d,i,s){return w(t=>{let e=0,n=[],o,r;return r=i.subscribe(u=>{for(let f of u)e===0?f[0]===p?n.push(f[1]):f[0]===b&&t.down([f]):f[0]===p?t.emit(f[1]):(f[0]===a||f[0]===b)&&t.down([f])}),o=d.subscribe(u=>{for(let f of u)if(e===0)if(f[0]===p)t.emit(f[1]);else if(f[0]===a){e=1;for(let l of n)t.emit(l);n.length=0}else f[0]===b&&t.down([f])}),()=>{o?.(),r?.()}},c(s))}function me(...d){return d.length===0?w(i=>{i.down([[a]])},c()):d.length===1?N([d[0]],(i,s)=>{let t=i[0];if(t==null||t.length===0){s.down([[m]]);return}for(let e of t)s.emit(e)},c()):w(i=>{let s=null,t=[];for(let e=0;e<d.length;e++){let n=e,o=d[e].subscribe(r=>{for(let u of r){if(s!==null&&n!==s)return;u[0]===p?(s===null&&(s=n),i.emit(u[1])):(u[0]===a||u[0]===b)&&(s===null||n===s)&&i.down([u])}});t.push(o)}return()=>{for(let e of t)e()}},c())}function I(d,i,s){let t,e=!1,n=()=>{e||(e=!0,s())};return t=d.subscribe(o=>{let r=!1,u=!1;for(let f of o)f[0]!==A&&(f[0]===p?i.emit(f[1]):f[0]===a?r=!0:f[0]===b?(u=!0,i.down([f])):(f[0]===W||f[0]===m)&&i.down([f]));u?(t?.(),t=void 0,n()):r&&n()}),()=>{t?.(),t=void 0}}function be(d,i,s){let t,e=!1;function n(){t?.(),t=void 0}return N([d],(o,r,u)=>{if(u.terminalDeps[0]!=null&&u.terminalDeps[0]!==!0){n();return}if(u.terminalDeps[0]===!0){e=!0,t||r.down([[a]]);return}let f=o[0];if(!(f==null||f.length===0))return n(),t=I(k(i(f[f.length-1])),r,()=>{n(),e&&r.down([[a]])}),{deactivate:()=>{n(),e=!1}}},{...c(s),completeWhenDepsComplete:!1,meta:{...h("switchMap"),...s?.meta??{}}})}function we(d,i,s){let t,e=!1;function n(){t?.(),t=void 0}return N([d],(o,r,u)=>{if(u.terminalDeps[0]!=null&&u.terminalDeps[0]!==!0){n();return}if(u.terminalDeps[0]===!0){e=!0,t||r.down([[a]]);return}let f=o[0];if(!(f==null||f.length===0))return t===void 0?t=I(k(i(f[0])),r,()=>{n(),e&&r.down([[a]])}):r.down([[m]]),{deactivate:()=>{n(),e=!1}}},{...c(s),completeWhenDepsComplete:!1})}function Ne(d,i,s){let{maxBuffer:t,...e}=s??{},n=[],o,r=!1,u;function f(){o?.(),o=void 0}function l(){if(!u||o!==void 0)return;if(n.length===0){r&&u.down([[a]]);return}let v=n.shift();o=I(k(i(v)),u,()=>{f(),l()})}function T(v){t&&t>0&&n.length>=t&&n.shift(),n.push(v),l()}return N([d],(v,x,E)=>{if(u=x,E.terminalDeps[0]!=null&&E.terminalDeps[0]!==!0){f(),n.length=0;return}if(E.terminalDeps[0]===!0){r=!0,l();return}let R=v[0];if(!(R==null||R.length===0)){for(let g of R)T(g);return{deactivate:()=>{f(),n.length=0,r=!1}}}},{...c(e),completeWhenDepsComplete:!1})}function L(d,i,s){let{concurrent:t,...e}=s??{},n=t!=null&&t>0?t:Number.POSITIVE_INFINITY,o=0,r=!1,u=new Set,f=[],l;function T(){r&&o===0&&f.length===0&&l&&l.down([[a]])}function v(g){if(!l)return;o++;let O;O=I(k(i(g)),l,()=>{O&&u.delete(O),o--,x(),T()}),u.add(O)}function x(){for(;f.length>0&&o<n;)v(f.shift())}function E(g){o<n?v(g):f.push(g)}function R(){for(let g of u)g();u.clear(),o=0,f.length=0}return N([d],(g,O,y)=>{if(l=O,y.terminalDeps[0]!=null&&y.terminalDeps[0]!==!0){R();return}if(y.terminalDeps[0]===!0){r=!0,T();return}let D=g[0];if(!(D==null||D.length===0)){for(let M of D)E(M);return{deactivate:()=>{R(),r=!1}}}},{...c(e),completeWhenDepsComplete:!1})}var he=L;function ve(d,i,s){return w(t=>{let e=new Set;function n(){for(let r of e)clearTimeout(r);e.clear()}let o=d.subscribe(r=>{for(let u of r)if(u[0]===p){let f=setTimeout(()=>{e.delete(f),t.emit(u[1])},i);e.add(f)}else if(u[0]===a){let f=setTimeout(()=>{e.delete(f),t.down([[a]])},i);e.add(f)}else u[0]===b&&(n(),t.down([u]))});return()=>{o(),n()}},c(s))}function _(d,i,s){return w(t=>{let e,n;function o(){e!==void 0&&(clearTimeout(e),e=void 0)}let r=d.subscribe(u=>{for(let f of u)f[0]===p?(o(),n=f[1],e=setTimeout(()=>{e=void 0,t.emit(n)},i)):f[0]===a?(e!==void 0&&(o(),t.emit(n)),t.down([[a]])):f[0]===b&&(o(),t.down([f]))});return()=>{r(),o()}},{...c(s),meta:{...h("debounce",{ms:i}),...s?.meta??{}}})}function j(d,i,s){let{leading:t,trailing:e,...n}=s??{},o=t!==!1,r=e===!0,u=i*1e6;return w(f=>{let l,T=-1/0,v,x=!1;function E(){l!==void 0&&(clearTimeout(l),l=void 0)}let R=d.subscribe(g=>{for(let O of g)if(O[0]===p){let y=O[1],D=U();if(o&&D-T>=u)T=D,f.emit(y),E(),r&&(l=setTimeout(()=>{l=void 0,x&&(T=U(),f.emit(v),x=!1)},i));else if(r&&(v=y,x=!0,l===void 0)){let M=(D-T)/1e6;l=setTimeout(()=>{l=void 0,x&&(T=U(),f.emit(v),x=!1)},Math.max(0,i-M))}}else(O[0]===a||O[0]===b)&&(E(),f.down([O]))});return()=>{R(),E()}},{...c(n),meta:{...h("throttle",{ms:i,leading:o,trailing:r}),...n.meta??{}}})}function ge(d,i,s){return w(t=>{let e,n=!1,o=!1,r=d.subscribe(f=>{if(!n)for(let l of f){if(n)return;l[0]===p?e={v:l[1]}:l[0]===b?(n=!0,t.down([l])):l[0]===a&&(o=!0,e=void 0)}}),u=i.subscribe(f=>{if(!n)for(let l of f){if(n)return;l[0]===p?e!==void 0&&!o&&t.emit(e.v):l[0]===b?(n=!0,t.down([l])):l[0]===a&&(n=!0,t.down([[a]]))}});return()=>{r(),u()}},c(s))}function Oe(d,i,s){return w(t=>{let e,n,o=!1;function r(){e!==void 0&&(clearTimeout(e),e=void 0)}let u=d.subscribe(f=>{for(let l of f)l[0]===p?(n=l[1],o=!0,r(),e=setTimeout(()=>{e=void 0,o&&(o=!1,t.emit(n))},i)):(l[0]===a||l[0]===b)&&(r(),t.down([l]))});return()=>{u(),r()}},c(s))}function xe(d,i,s){let{with:t,...e}=s??{},n=t??new Error("timeout");return w(o=>{let r;function u(){clearTimeout(r),r=setTimeout(()=>{r=void 0,o.down([[b,n]])},i)}u();let f=d.subscribe(l=>{for(let T of l)T[0]===p?(u(),o.emit(T[1])):(T[0]===a||T[0]===b)&&(clearTimeout(r),o.down([T]))});return()=>{f(),clearTimeout(r)}},c(e))}function Ee(d,i,s){return w(t=>{let e=[],n=d.subscribe(r=>{for(let u of r)u[0]===p?e.push(u[1]):u[0]===a?(e.length>0&&t.emit([...e]),e.length=0,t.down([[a]])):u[0]===b&&t.down([u])}),o=i.subscribe(r=>{for(let u of r)u[0]===p?e.length>0&&(t.emit([...e]),e.length=0):u[0]===a?t.down([[a]]):u[0]===b&&t.down([u])});return()=>{n(),o(),e.length=0}},c(s))}function Re(d,i,s){if(i<=0)throw new RangeError("bufferCount expects count > 0");return w(t=>{let e=[],n=d.subscribe(o=>{for(let r of o)r[0]===p?(e.push(r[1]),e.length>=i&&t.emit(e.splice(0,e.length))):r[0]===a?(e.length>0&&t.emit([...e]),e.length=0,t.down([[a]])):r[0]===b&&t.down([r])});return()=>{n(),e.length=0}},c(s))}function De(d,i,s){if(i<=0)throw new RangeError("windowCount expects count > 0");return w(t=>{let e,n=0;function o(){let u=w(f=>(e=f.down.bind(f),()=>{e=void 0}),c());n=0,t.emit(u)}let r=d.subscribe(u=>{for(let f of u)f[0]===p?(e||o(),e?.([[p,f[1]]]),n+=1,n>=i&&(e?.([[a]]),e=void 0)):f[0]===a?(e?.([[a]]),e=void 0,t.down([[a]])):f[0]===b&&(e?.([f]),e=void 0,t.down([f]))});return()=>{r(),e?.([[a]]),e=void 0}},c(s))}function ye(d,i,s){return w(t=>{let e=[],n=setInterval(()=>{e.length>0&&(t.emit([...e]),e.length=0)},i),o=d.subscribe(r=>{for(let u of r)u[0]===p?e.push(u[1]):u[0]===a?(clearInterval(n),e.length>0&&t.emit([...e]),e.length=0,t.down([[a]])):u[0]===b&&(clearInterval(n),t.down([u]))});return()=>{o(),clearInterval(n),e.length=0}},{...c(s),meta:{...h("bufferTime",{ms:i}),...s?.meta??{}}})}function ke(d,i,s){return w(t=>{let e;function n(){e?.([[a]]),e=void 0}function o(){let f=w(l=>(e=l.down.bind(l),()=>{e=void 0}),c());t.emit(f)}o();let r=setInterval(()=>{n(),o()},i),u=d.subscribe(f=>{for(let l of f)l[0]===p?e?.([[p,l[1]]]):l[0]===a?(clearInterval(r),n(),t.down([[a]])):l[0]===b&&(clearInterval(r),e?.([l]),n(),t.down([l]))});return()=>{u(),clearInterval(r),n()}},c(s))}function Ue(d,i,s){return w(t=>{let e;function n(){e?.([[a]]),e=void 0}function o(){let f=w(l=>(e=l.down.bind(l),()=>{e=void 0}),c());t.emit(f)}let r=d.subscribe(f=>{for(let l of f)l[0]===p?(e||o(),e?.([[p,l[1]]])):l[0]===a?(n(),t.down([[a]])):l[0]===b&&(e?.([l]),e=void 0,t.down([l]))}),u=i.subscribe(f=>{for(let l of f)l[0]===p&&(n(),o())});return()=>{r(),u(),n()}},c(s))}function Ie(d,i){return w((s,t)=>{"n"in t.store||(t.store.n=0);let e=setInterval(()=>{s.emit(t.store.n),t.store.n=t.store.n+1},d);return()=>clearInterval(e)},c(i))}function Me(d,i,s){if(i<=0)throw new RangeError("repeat expects count > 0");return w(t=>{let e=i,n,o=()=>{n?.(),n=d.subscribe(r=>{let u=!1,f=[];for(let l of r)l[0]===a?u=!0:f.push(l);f.length>0&&t.down(f),u&&(n?.(),n=void 0,e-=1,e>0?o():t.down([[a]]))})};return o(),()=>{n?.()}},c(s))}function Ce(d,i){return N([d],(s,t)=>{let e=s[0];if(e==null||e.length===0){t.down([[m]]);return}for(let n of e)t.emit(n)},c(i))}function Y(d,i,s){return w(t=>{let e=d.subscribe(n=>{for(let o of n)if(o[0]===p)t.emit(o[1]);else if(o[0]===b)try{t.emit(i(o[1]))}catch(r){t.down([[b,r]])}else o[0]===a&&t.down([[a]])});return()=>{e()}},c(s))}function Ae(d,i,s){return N([d,i],(t,e,n)=>{let o=t[1];if(!(o!=null&&o.length>0?o.at(-1):n.prevData[1])){e.down([[m]]);return}let u=t[0];if(u!=null&&u.length>0){for(let f of u)e.emit(f);return}if(o!=null&&o.length>0&&n.prevData[0]!==void 0){e.emit(n.prevData[0]);return}e.down([[m]])},S(s))}var We=F,Pe=_,Be=j,Se=Y;export{Z as a,V as b,$ as c,ee as d,C as e,K as f,ne as g,te as h,oe as i,re as j,se as k,ie as l,ue as m,q as n,fe as o,de as p,le as q,F as r,ae as s,ce as t,Te as u,pe as v,me as w,be as x,we as y,Ne as z,L as A,he as B,ve as C,_ as D,j as E,ge as F,Oe as G,xe as H,Ee as I,Re as J,De as K,ye as L,ke as M,Ue as N,Ie as O,Me as P,Ce as Q,Y as R,Ae as S,We as T,Pe as U,Be as V,Se as W};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as M,f as re,g as se,h as oe,i as ae}from"./chunk-FDQGFWLF.js";import{a as ee}from"./chunk-L6NSJVJZ.js";import{j as ne}from"./chunk-626TESAC.js";import{b as te}from"./chunk-35JTVPOX.js";import{b as J}from"./chunk-JQFH2DV6.js";import{C as V}from"./chunk-V5A7M7RJ.js";import{D as X,E as Y,G as j,p as W,t as D}from"./chunk-LYCLF26R.js";import{b as Q}from"./chunk-CK2E7BTU.js";import{b as le}from"./chunk-QYADASLV.js";var ye={};le(ye,{CqrsGraph:()=>F,cqrs:()=>me,cqrsEventKeyOf:()=>he,dispatchKeyOf:()=>ve,sagaInvocationKeyOf:()=>fe});var I=class extends Error{constructor(e,n){super(e,n),this.name=this.constructor.name}},N=class extends I{constructor(n,t){super(`Duplicate ${n} registration: "${t}"`);this.kind=n;this.registrationName=t}},B=class extends I{constructor(n,t,r){super(`Command "${n}" emitted undeclared event "${t}". Declared emits: [${r.join(", ")}]`);this.commandName=n;this.eventName=t;this.declaredEmits=r}},K=class extends I{constructor(n,t,r){super(`Optimistic concurrency conflict on aggregate "${n}": expected version ${t}, got ${r}`);this.aggregateId=n;this.expected=t;this.actual=r}},H=class extends I{constructor(n){super(`Unknown command: "${n}". Register with command() first.`);this.commandName=n}},O=class extends I{constructor(n,t){super(`Command handler "${n}" threw: ${t instanceof Error?t.message:String(t)}`,{cause:t});this.commandName=n}};var P=class extends I{constructor(n,t){super(`Projection "${n}" rebuild failed: ${t instanceof Error?t.message:String(t)}`,{cause:t});this.projectionName=n}};var ue=D((o,e)=>{o("write"),o("signal"),e("observe")}),pe=D((o,e)=>{o("observe"),o("signal"),e("write")}),ie=D((o,e)=>{o("observe"),o("signal"),e("write")});function $(o,e){return ee("cqrs",o,e)}function de(o){if(o===null||typeof o!="object"||Object.isFrozen(o))return o;for(let e of Object.keys(o))de(o[e]);return Object.freeze(o)}var he=o=>`${o.type}::${o.aggregateId??"__default__"}`,ve=o=>o.commandName,fe=o=>o.eventType,F=class extends ne{_eventLogs=new Map;_eventLogsByAggregate=new Map;_aggregateVersions=new Map;_aggregateLru=new Map;_commandRegs=new Map;_projections=new Set;_sagas=new Set;_keepaliveDisposers=[];_seq=0;_retainedLimit;_freezeCommandPayload;_freezeEventPayload;_maxAggregates;_dispatchSeqCursor;dispatches;audit;aggregateEvictions;constructor(e,n={}){super(e,n.graph),this._retainedLimit=n.retainedLimit??1024,this._freezeCommandPayload=n.freezeCommandPayload??!0,this._freezeEventPayload=n.freezeEventPayload??!0,this._maxAggregates=n.maxAggregates??1e4,this.dispatches=M({name:"dispatches",retainedLimit:this._retainedLimit,graph:this}),this.audit=this.dispatches,this.aggregateEvictions=M({name:"aggregateEvictions",retainedLimit:this._retainedLimit,graph:this}),this._dispatchSeqCursor=oe(this,"dispatch_seq",0)}aggregateVersion(e,n){return this._aggregateVersions.get(`${e}::${n}`)??0}_touchAggregate(e){this._aggregateLru.delete(e),this._aggregateLru.set(e,!0)}_enforceAggregateLru(){for(;this._aggregateLru.size>this._maxAggregates;){let e=this._aggregateLru.keys().next();if(e.done)break;let n=e.value;this._aggregateLru.delete(n);let t=n.indexOf("::");if(t<0)continue;let r=n.slice(0,t),s=n.slice(t+2),a=this._aggregateVersions.get(n)??0;this._aggregateVersions.delete(n);let d=this._eventLogsByAggregate.get(r);d&&(d.delete(s),d.size===0&&this._eventLogsByAggregate.delete(r)),this.aggregateEvictions.append({aggregateId:s,type:r,lastVersion:a,t_ns:W()})}}destroy(){for(let e of this._keepaliveDisposers)e();this._keepaliveDisposers.length=0,super.destroy()}_attachedEventTiers=[];_attachedTierDisposers=new Map;attachEventStorage(e){this._attachedEventTiers.push(e);for(let[n,t]of this._eventLogs){let r=t.log.attachStorage(e),s=this._attachedTierDisposers.get(n);s||(s=[],this._attachedTierDisposers.set(n,s)),s.push(r)}for(let[n,t]of this._eventLogsByAggregate)for(let[r,s]of t){let a=`${n}::${r}`,d=s.log.attachStorage(e),u=this._attachedTierDisposers.get(a);u||(u=[],this._attachedTierDisposers.set(a,u)),u.push(d)}return()=>{let n=this._attachedEventTiers.indexOf(e);n>=0&&this._attachedEventTiers.splice(n,1)}}_autoWireStreamStorage(e,n){if(this._attachedEventTiers.length===0)return;let t=this._attachedTierDisposers.get(e);t||(t=[],this._attachedTierDisposers.set(e,t));for(let r of this._attachedEventTiers)t.push(n.attachStorage(r))}event(e,n){if(n!==void 0)return this._ensureAggregateStream(e,n).node;let t=this._eventLogs.get(e);if(t)return t.node;let r=J([],{name:e,versioning:0,maxSize:this._retainedLimit});r.withLatest();let s=r.entries,a=j([s],([d])=>d,{name:e,describeKind:"state",meta:$("event",{event_name:e}),guard:ie,initial:s.cache});return this.add(a,{name:e}),this._keepaliveDisposers.push(V(a)),this._eventLogs.set(e,{log:r,node:a}),this._autoWireStreamStorage(e,r),a}_ensureAggregateStream(e,n){this._eventLogs.has(e)||this.event(e);let t=this._eventLogsByAggregate.get(e);t||(t=new Map,this._eventLogsByAggregate.set(e,t));let r=`${e}::${n}`;this._touchAggregate(r);let s=t.get(n);if(s)return s;let a=`${e}_${n.replace(/[^a-zA-Z0-9_-]/g,"_")}`,d=J([],{name:a,versioning:0,maxSize:this._retainedLimit});d.withLatest();let u=d.entries,i=j([u],([T])=>T,{name:a,describeKind:"state",meta:$("event_aggregate",{event_name:e,aggregate_id:n}),guard:ie,initial:u.cache}),g=a,h=0;for(;this.nameOf(this.resolveOptional(g)??i)===g&&(h+=1,g=`${a}_${h}`,this.resolveOptional(g)!==void 0););try{this.add(i,{name:g})}catch{}this._keepaliveDisposers.push(V(i));let w={log:d,node:i};return t.set(n,w),this._autoWireStreamStorage(`${e}::${n}`,d),this._enforceAggregateLru(),w}resolveOptional(e){try{return this.resolve(e)}catch{return}}_appendEvent(e,n,t){let r=this._eventLogs.get(e);if(r||(this.event(e),r=this._eventLogs.get(e)),r.node.status==="completed"||r.node.status==="errored")throw new Error(`Cannot dispatch to terminated event stream "${e}" (status: ${r.node.status}).`);let s,a;if(t?.aggregateId!==void 0){let g=`${e}::${t.aggregateId}`;s=(this._aggregateVersions.get(g)??0)+1,this._aggregateVersions.set(g,s),a=this._ensureAggregateStream(e,t.aggregateId)}let d=r.log.entries.v,u=this._freezeEventPayload?de(n):n,i={type:e,payload:u,timestampNs:W(),seq:++this._seq,...t?.aggregateId!==void 0?{aggregateId:t.aggregateId}:{},...s!==void 0?{aggregateVersion:s}:{},...t?.correlationId!==void 0?{correlationId:t.correlationId}:{},...t?.causationId!==void 0?{causationId:t.causationId}:{},...t?.metadata!==void 0?{metadata:Object.freeze({...t.metadata})}:{},...t?.handlerVersion!==void 0?{handlerVersion:t.handlerVersion}:{},...d!=null?{v0:{id:d.id,version:d.version}}:{}};return r.log.append(i),a&&a.log.append(i),i}command(e,n){if(this._commandRegs.has(e))throw new N("command",e);let t=typeof n=="function"?{handler:n}:n,r=Y(void 0,{name:e,describeKind:"state",meta:{...$("command",{command_name:e}),error:null},guard:ue});if(this.add(r,{name:e}),this._commandRegs.set(e,{handler:t.handler,...t.emits!==void 0?{emits:t.emits}:{},...t.handlerVersion!==void 0?{handlerVersion:t.handlerVersion}:{}}),t.emits)for(let s of t.emits)this._eventLogs.has(s)||this.event(s);return r}dispatch(e,n,t){let r=this._commandRegs.get(e);if(!r)throw new H(e);if(t?.aggregateId!==void 0&&t.expectedAggregateVersion!==void 0&&r.emits!==void 0){let i=0;for(let g of r.emits){let h=this._aggregateVersions.get(`${g}::${t.aggregateId}`);h!==void 0&&h>i&&(i=h)}if(i!==t.expectedAggregateVersion)throw new K(t.aggregateId,t.expectedAggregateVersion,i)}let s=this.resolve(e),a=[],d=!1,u=i=>{s.emit(i,{internal:!0});try{r.handler(i,{emit:(g,h)=>{if(r.emits!==void 0&&!r.emits.includes(g))throw new B(e,g,r.emits);a.push(g),this._appendEvent(g,h,{...t?.aggregateId!==void 0?{aggregateId:t.aggregateId}:{},...t?.correlationId!==void 0?{correlationId:t.correlationId}:{},...t?.causationId!==void 0?{causationId:t.causationId}:{},...t?.metadata!==void 0?{metadata:Object.freeze({...t.metadata})}:{},...r.handlerVersion!==void 0?{handlerVersion:r.handlerVersion}:{}})}}),s.meta.error.emit(null,{internal:!0})}catch(g){throw d=!0,g}};try{se(u,{audit:this.dispatches,seq:this._dispatchSeqCursor,freeze:this._freezeCommandPayload,onSuccess:([i],g,{t_ns:h,seq:w})=>({commandName:e,payload:i,outcome:"success",emittedEvents:[...a],t_ns:h,seq:w??0,...r.handlerVersion!==void 0?{handlerVersion:r.handlerVersion}:{}}),onFailure:([i],g,{t_ns:h,seq:w,errorType:T})=>{let p=g instanceof O?g:new O(e,g);return{commandName:e,payload:i,outcome:"failure",error:p,errorType:T,emittedEvents:[...a],t_ns:h,seq:w??0,...r.handlerVersion!==void 0?{handlerVersion:r.handlerVersion}:{}}}})(n)}catch(i){throw d&&s.meta.error.emit(i,{internal:!0}),i}}projection(e){let{name:n,events:t,reducer:r,initial:s}=e,a=e.mode??"scan",d=e.freezeInputs??!0,u=e.snapshot,i=t.map(l=>(this._eventLogs.has(l)||this.event(l),this._eventLogs.get(l).node));function g(l){l.sort((c,v)=>c.timestampNs-v.timestampNs||c.seq-v.seq||(c.aggregateId??"").localeCompare(v.aggregateId??""))}function h(l){let c=[];for(let v of l)c.push(...v);return g(c),c}let w=i.map(l=>l.cache??[]),T=h(w),p=d?Object.freeze(T):T,m=0,y=s;a==="scan"&&T.length>0&&(y=r(s,p),m=T.length);let E=a==="replay"?r(s,p):y,S=u?.saveDebounceMs??1e3,A=u?.saveEvery??1e3,_,x=0;function R(l){if(u?.save){if(x+=1,x>=A){x=0,_!==void 0&&(clearTimeout(_),_=void 0);let c=u.save(l);c instanceof Promise&&c.catch(()=>{});return}_!==void 0&&clearTimeout(_),_=setTimeout(()=>{_=void 0,x=0;let c=u.save(l);c instanceof Promise&&c.catch(()=>{})},S)}}let k=j(i,l=>{let c=h(l),v;if(a==="replay"){let b=d?Object.freeze(c):c;v=r(s,b)}else{let b=c.slice(m);m=c.length;let f=d?Object.freeze(b):b;v=r(y,f),y=v}return R(v),v},{name:n,describeKind:"derived",meta:$("projection",{projection_name:n,source_events:t}),guard:pe,initial:E});return this.add(k,{name:n}),this._keepaliveDisposers.push(V(k)),this._keepaliveDisposers.push(()=>{_!==void 0&&(clearTimeout(_),_=void 0)}),this._projections.add(n),{node:k,rebuild:async l=>{try{let c=l?.pageSize??1e3,v=l?.fromTier??this._attachedEventTiers[0]?.[0],b=h(i.map(C=>C.cache??[])).length,f=s;if(u?.load){let C=await u.load();C!==void 0&&(f=C)}if(!v||!v.loadEntries){let C=h(i.map(L=>L.cache??[])),q=d?Object.freeze(C):C;f=r(f,q)}else{let C=new Set(t),q,L=!1;for(;!L;){let G=await v.loadEntries({cursor:q,pageSize:c}),U=[...G.entries].filter(ce=>C.has(ce.type));g(U);let ge=d?Object.freeze(U):U;f=r(f,ge),q=G.cursor,L=!q||G.entries.length===0}}if(a==="scan"){let C=h(i.map(L=>L.cache??[])),q=C.slice(b);if(q.length>0){let L=d?Object.freeze(q):q;f=r(f,L)}y=f,m=C.length}return k.emit(f,{internal:!0}),f}catch(c){throw new P(n,c)}},reset:async()=>{try{let l=s;if(u?.load){let f=await u.load();f!==void 0&&(l=f)}let c=h(i.map(f=>f.cache??[])),v=d?Object.freeze(c):c,b=r(l,v);return a==="scan"&&(y=b,m=c.length),k.emit(b,{internal:!0}),b}catch(l){throw new P(n,l)}}}}saga(e,n,t,r={}){let s=n.map(p=>(this._eventLogs.has(p)||this.event(p),this._eventLogs.get(p).node)),a=ae(this,`${e}_cursor`,n,0),d=M({name:`${e}_invocations`,retainedLimit:this._retainedLimit,graph:this}),u=r.aggregateId,i=r.errorPolicy??"advance",g=new Map;for(let p of n){let m=a[p];g.set(p,m.cache??0);let y=m.subscribe(E=>{for(let S of E)S[0]===Q&&g.set(p,S[1])});this._keepaliveDisposers.push(y)}let h=re((p,m)=>{t(p)},{audit:d,freeze:!1,...r.handlerVersion!==void 0?{handlerVersion:r.handlerVersion}:{},onSuccess:([p,m],y,{t_ns:E})=>({eventType:m,outcome:"success",aggregateId:p.aggregateId,event:p,t_ns:E}),onFailure:([p,m],y,{t_ns:E,errorType:S})=>({eventType:m,outcome:"failure",error:y,errorType:S,aggregateId:p.aggregateId,event:p,t_ns:E})}),w={},T=X(s,(p,m)=>{let y=w.n.meta.error;for(let E=0;E<p.length;E++){let S=p[E];if(S==null||S.length===0)continue;let A=S.at(-1);if(!A)continue;let _=n[E],x=a[_],R=g.get(_)??0;if(A.length>R){let k=A.slice(R),z=R;for(let Z of k){let l=Z;if(u!==void 0&&l.aggregateId!==u){z+=1;continue}try{h(l,_),y.emit(null,{internal:!0}),z+=1}catch(c){if(y.emit(c,{internal:!0}),i==="hold")break;z+=1}}x.emit(z)}}},{name:e,describeKind:"effect",meta:{...$("saga",{saga_name:e,source_events:n}),error:null}});return w.n=T,this.add(T,{name:e}),this._keepaliveDisposers.push(V(T)),this._sagas.add(e),{node:T,invocations:d,audit:d,cursors:a}}};function me(o,e){let n=new F(o,e),{factory:t,factoryArgs:r,...s}=e??{};return n.tagFactory("cqrs",te(s)),n}export{he as a,ve as b,fe as c,F as d,me as e,ye as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as x,x as w}from"./chunk-
|
|
1
|
+
import{m as x,x as w}from"./chunk-V5A7M7RJ.js";import{i as g,j as p}from"./chunk-CK2E7BTU.js";async function k(o){let i=typeof o=="string"?new TextEncoder().encode(o):o,c=await globalThis.crypto.subtle.digest("SHA-256",i),t=new Uint8Array(c),n="";for(let r=0;r<t.length;r++)n+=b[t[r]];return n}var b=new Array(256);for(let o=0;o<256;o++)b[o]=o.toString(16).padStart(2,"0");var m=class extends Error{constructor(c,t){super(`content-addressed lookup miss in read-strict mode: ${c}`);this.key=c;this.context=t;this.name="ContentAddressedMissError"}};function T(o){let i=new Set,c=t=>{if(t===null||typeof t!="object")return t;let n=t;if(i.has(n))return{__cycle:!0};i.add(n);try{if(Array.isArray(t))return t.map(c);let r={};for(let d of Object.keys(t).sort())r[d]=c(t[d]);return r}finally{i.delete(n)}};return JSON.stringify(c(o))}function P(o){let{storage:i,keyContext:c,keyPrefix:t,mode:n="read-write"}=o,r=c??(e=>e);async function d(e){let s=T(r(e)),a=await k(s);return t?`${t}:${a}`:a}return{keyFor:d,async lookup(e){if(n==="write")return;let s=await d(e),a=await i.load(s);if(a===void 0){if(n==="read-strict")throw new m(s,e);return}return a},async store(e,s){if(n==="read")return;let a=await d(e);await i.save(a,s)},async forget(e){if(n==="read"||n==="write"||!i.delete)return;let s=await d(e);await i.delete(s)}}}function K(o,i={}){let c=i.keyFn??(n=>String(n)),t=new Map;return n=>{let r=c(n),d=t.get(r);if(d)return d;let e=o(n),s;e!=null&&typeof e.then=="function"?s=Promise.resolve(e):e!=null&&typeof e=="object"&&"subscribe"in e&&"cache"in e?s=w(e):e!=null&&typeof e=="object"&&Symbol.asyncIterator in e?s=(async()=>{let u=e[Symbol.asyncIterator]();try{let{value:l,done:f}=await u.next();if(f)throw new Error("singleFromAny: factory returned empty async iterable");return l}finally{await u.return?.()}})():e!=null&&typeof e=="object"&&Symbol.iterator in e?s=(async()=>{let u=e[Symbol.iterator]();try{let{value:l,done:f}=u.next();if(f)throw new Error("singleFromAny: factory returned empty iterable");return l}finally{u.return?.()}})():s=Promise.resolve(e);let a,y=()=>{t.get(r)===a&&t.delete(r)};return a=s.then(u=>(y(),u),u=>{throw y(),u}),t.set(r,a),a}}function j(o,i={}){let c=i.keyFn??(n=>String(n)),t=new Map;return n=>{let r=c(n),d=t.get(r);if(d)return d;let e=x(o(n));t.set(r,e);let s=e.subscribe(a=>{for(let y of a)if(y[0]===p||y[0]===g){t.get(r)===e&&t.delete(r),s();return}});return e}}export{k as a,m as b,T as c,P as d,K as e,j as f};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as X}from"./chunk-
|
|
1
|
+
import{b as X}from"./chunk-CUNIRONA.js";import{h as Q,j as U}from"./chunk-626TESAC.js";import{E as z,F as W,G as Y,H as V}from"./chunk-LYCLF26R.js";import{b as ie}from"./chunk-QYADASLV.js";var he={};ie(he,{compileSpec:()=>ue,decompileSpec:()=>me,extractFnFactory:()=>te,extractSourceFactory:()=>ne,generateCatalogPrompt:()=>oe,isRichFnEntry:()=>T,isRichSourceEntry:()=>I,llmCompose:()=>ye,llmRefine:()=>ae,specDiff:()=>ge,validateSpec:()=>q,validateSpecAgainstCatalog:()=>K});function M(n){let e=n.meta?.factory;return typeof e=="string"?e:void 0}function C(n){let e=n.meta?.factoryArgs;return e!=null&&typeof e=="object"?e:{}}function Z(n){let e=C(n);return"initial"in e?e.initial:n.value}function T(n){return typeof n=="object"&&n!==null&&"factory"in n}function I(n){return typeof n=="object"&&n!==null&&"factory"in n}function te(n){return T(n)?n.factory:n}function ne(n){return I(n)?n.factory:n}function oe(n){let e=[];if(n.fns){let o=new Map;for(let[s,f]of Object.entries(n.fns)){let p=T(f)?f.tags?.[0]??"Other":"Other";o.has(p)||o.set(p,[]),o.get(p).push(ce(s,f))}for(let[s,f]of o)e.push(`${s}:
|
|
2
2
|
${f.join(`
|
|
3
3
|
`)}`)}if(n.sources){let o=[];for(let[s,f]of Object.entries(n.sources))o.push(pe(s,f));o.length>0&&e.push(`Sources:
|
|
4
4
|
${o.join(`
|